-
Notifications
You must be signed in to change notification settings - Fork 10
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
Clean up test_atfparser #85
Commits on Jul 8, 2019
-
test_atfparser: Covert to pytest.
This set of tests were written to use the `unittest` framework from the standard library but we invoke them through pytest, which provides better reporting. Remove the unittest dependency here to align with changes made to other tests. As a minimal change, keep the TestParser class, but remove the inheritance from `unittest.TestCase`. The pytest package instead finds tests based on general introspection. By marking the setUp method, which has a special meaning in the unittest framework as a pytest fixture with `autouse=True` we ensure it is called before every test to set up the member variable.
Configuration menu - View commit details
-
Copy full SHA for a39cf36 - Browse repository at this point
Copy the full SHA a39cf36View commit details -
test_atfparser: Promote tests to module level.
Move the lexer fixture into the `try_parse` helper. None of the tests need subsequent access to the lexer state, so there's no reason for it to be shared. Without shared state, the TestParser class can itself be removed. It was necessary under the `unittest` framework, but `pytest` can use module functions instead. This simplifies the code and saves an indent level.
Configuration menu - View commit details
-
Copy full SHA for 5fa4c48 - Browse repository at this point
Copy the full SHA 5fa4c48View commit details -
test_atfparser: Check for Score objects.
The parser creates `Score` objects from atf records so marked. Verify this in the related tests.
Configuration menu - View commit details
-
Copy full SHA for cdcf849 - Browse repository at this point
Copy the full SHA cdcf849View commit details -
test_atfparser: Mark incomplete tests with TODO.
These tests include atf snippets for features which the lexer accepts, but the parser currently skips. They were marked with a commented-out @Skip decorator. With the migration to pytest these should become @pytest.skip instead. Instead I moved the annotation to a TODO comment, mostly because I like the style better. I also added basic asserts on the parser result to silence warnings. For an example of the '={' atf syntax, see the sample corpus, and e.g. http://oracc.iaas.upenn.edu/saao/saa10/P334031/html
Configuration menu - View commit details
-
Copy full SHA for b4c78a7 - Browse repository at this point
Copy the full SHA b4c78a7View commit details
Commits on Jul 11, 2019
-
test_atfparser: Verify score object attributes.
Check the attributes on the Score object returned from the parser.
Configuration menu - View commit details
-
Copy full SHA for bb30c91 - Browse repository at this point
Copy the full SHA bb30c91View commit details -
test_atfparser: Verify more score options.
Parametrize the test with the different configurations described in http://oracc.museum.upenn.edu/doc/help/editinginatf/scores/ This verifies more of the documented variants are accepted.
Configuration menu - View commit details
-
Copy full SHA for cffbc1f - Browse repository at this point
Copy the full SHA cffbc1fView commit details -
test_atfparser: Skip tests for unimplemented features.
Restore the skip annotation for tests referencing features supported by the lexer but not the parser. While there's some value in verifying the parser accepts the input strings, it's more useful to mark the state of the actual implementation in the pytest output.
Configuration menu - View commit details
-
Copy full SHA for 5910213 - Browse repository at this point
Copy the full SHA 5910213View commit details