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

Clean up test_atfparser #85

Merged
merged 7 commits into from
Jul 12, 2019
Merged

Clean up test_atfparser #85

merged 7 commits into from
Jul 12, 2019

Commits on Jul 8, 2019

  1. 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.
    rillian committed Jul 8, 2019
    Configuration menu
    Copy the full SHA
    a39cf36 View commit details
    Browse the repository at this point in the history
  2. 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.
    rillian committed Jul 8, 2019
    Configuration menu
    Copy the full SHA
    5fa4c48 View commit details
    Browse the repository at this point in the history
  3. test_atfparser: Check for Score objects.

    The parser creates `Score` objects from atf records so marked.
    Verify this in the related tests.
    rillian committed Jul 8, 2019
    Configuration menu
    Copy the full SHA
    cdcf849 View commit details
    Browse the repository at this point in the history
  4. 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
    rillian committed Jul 8, 2019
    Configuration menu
    Copy the full SHA
    b4c78a7 View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2019

  1. test_atfparser: Verify score object attributes.

    Check the attributes on the Score object returned from the
    parser.
    rillian committed Jul 11, 2019
    Configuration menu
    Copy the full SHA
    bb30c91 View commit details
    Browse the repository at this point in the history
  2. 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.
    rillian committed Jul 11, 2019
    Configuration menu
    Copy the full SHA
    cffbc1f View commit details
    Browse the repository at this point in the history
  3. 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.
    rillian committed Jul 11, 2019
    Configuration menu
    Copy the full SHA
    5910213 View commit details
    Browse the repository at this point in the history