[contextgen] Honor parameterization in generator instance, expose parameters to serialize#1983
Conversation
|
looks like the failing tests are choices to make - the old behavior didn't honor the defaults set in the instance, so the tests confirm that. if we want that to be the case (ie. when you set a value in the generator instance it is actually used) then we need to change those tests probably. since this PR is unsolicited i'll wait until someone confirms this is the desired behavior before fixing |
|
Hey @sneakers-the-rat sorry I misunderstood the comments above. It sounds like this may still be worthwhile, so I'm going to leave it open... and possibly revisit this myself. As you mentioned, we have had some PRs piling up. That is something I'm trying to improve and some of that is reducing our cognitive tax in having so many dead PRs open. With that said, I don't want to lose meaningful work so I'll see what we can do about this one. Also, if you feel like anything is sitting please ping me on it and I'll try to move it along. |
|
This one is relatively simple - should I update the test cases to reflect the working state? Or should we remove those parameters? |
|
@sneakers-the-rat I'm sorry my attention was pulled elsewhere for a while and I just got back to this one. Yes, this looks simple and I'd like to get it in. Can you resolve the conflict and I'll try to get it merged right away? It looks like a simple matter of accepting your change but I don't want to end up doing something foolish so I defer to you. |
b72fcd3 to
82e4181
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1983 +/- ##
==========================================
+ Coverage 79.54% 83.20% +3.66%
==========================================
Files 155 155
Lines 17545 17567 +22
Branches 3582 3589 +7
==========================================
+ Hits 13956 14617 +661
+ Misses 2834 2149 -685
- Partials 755 801 +46
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
alright, so maybe unsurprisingly, fixing this unmasked some other bugs. So since the previous behavior was to incorrectly ignore the instance attributes on the context genera, and the library had come to expect it to be incorrect, when the contextgen started using its instance attributes a lot of the tests, particularly the snapshot tests which are not specific and always require changes whenver the code changes at all, we had to fix a few tests to explicitly specify the things they were expecting of the context generator. Additionally, the non-context json-ld generator's CLI was broken, where not passing
|
b2132b8 to
c051386
Compare
amc-corey-cox
left a comment
There was a problem hiding this comment.
This looks good to me.
Builds on #1982
Noticed that the contextgen advertises parameters in its dataclass fields that it then ignores during serialization.
If those fields exist, they should do something!
set all args to default
Noneand use instance attributes as defaults instead of method args as defaults - parameters can be set in the instance body, but overridden when callingserialize