Skip to content
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

Reformat tests to use Pytest style; fix infinite comparison for OneOfASet #45

Merged
merged 3 commits into from
May 10, 2024

Conversation

ColeDCrawford
Copy link
Contributor

pytest format tests have more functionality and are a bit cleaner.

The failing test was due to OneOfASet._estrict_date() potentially returning inf or -inf. This fixes the logic there to return inf or -inf if an inf or -inf are in the set with a LATEST or EARLIEST lean, respectively. It returns before making the comparison that was previously failing (TypeError: '>' not supported between instances of 'float' and 'time.struct_time').

- Use parameterization in pytest to simplify many test cases by wrapping the input and expected values in tuples
- No need for unittest or class wrappers
- There is a legitimately failing test in parser/tests.py - code change needed in parser_classes to handle this I think
- natlang/tests.py will need to be updated to match the new spec, as will the whole text_to_edtf() function
The max and min functions now use a generator expression to filter out infinite values unless they are directly relevant to the calculation; if inf or -inf are found, they are returned instead of doing a comparison.
Use v5, which uses node v20 rather than deprecated v16
@ColeDCrawford ColeDCrawford marked this pull request as ready for review May 9, 2024 19:01
@aweakley
Copy link
Member

Wow, this makes things much clearer. Thank you.

@aweakley aweakley merged commit 98636f7 into ixc:v5 May 10, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants