-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate AfidSet for testing #24
Conversation
- Add a strategy that updates afids_coords to generating a near-complete AfidSet. `desc` was left out as it would not be read upon saving and this field may be dropped in future updates. - Additionally adds a round-trip AfidSet.load, asserting that the file loaded is of the correct class in `save_fcsv`
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 8 8
Lines 348 353 +5
=========================================
+ Hits 348 353 +5
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor comments but this largely looks good
@@ -19,7 +19,7 @@ class AfidPosition: | |||
x: float = attrs.field() | |||
y: float = attrs.field() | |||
z: float = attrs.field() | |||
desc: str = attrs.field() | |||
desc: str = attrs.field(default="") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not have a default value that's invalid here (even if you want to leave the invalid desc
s in the test for now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I think alternatively I can load in the valid descs
and any invalid ones set to "Unknown".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable to me, or you can just leave it without a default until we implement the validation
def test_invalid_num_afids(self, afids_coords: list[AfidPosition]) -> None: | ||
# Check to see if file can be loaded with afids-utils | ||
test_load = AfidSet.load(out_fcsv_file.name) | ||
assert isinstance(test_load, AfidSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could even assert test_load == afids_set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yeah, this test can be simplified quite a bit with the new afid_sets
strategy (and slight modification since it also randomly generates the slicer version by default)
Oh nvm, I see. it is because #25 got merged in and that was based off of this one. Oops. Will make a new patch PR to address the comments |
Proposed changes
This PR updates and renames the
afid_coord
strategy toafid_set
, generating a near completeAfidSet
object (sans desc). This allows for future testing of methods requiring a (in)validAfidSet
, while still being able to use a list ofAfidPositions
by invokingAfidSet.afids
.Additionally, this adds in an additional
AfidSet.load
to thevalid_save_fcsv
test, to ensure that the generated AfidSet that is saved can also be loaded.Types of changes
What types of changes does your code introduce? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you are unsure about any of the choices, don't hesitate to ask!poe quality
taskNotes
All PRs will undergo the unit testing before being reviewed. You may be requested to explain or make additional changes before the PR is accepted.