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

Convert translate_algebra tests to pytest #1636

Merged

Commits on Dec 31, 2021

  1. Convert translate_algebra tests to pytest

    As far as I can tell all the tests inside test/translate_algebra
    basically did the following:
    
    ```python
    query_tree = parser.parseQuery(self.query_text)
    query_algebra = algebra.translateQuery(query_tree)
    self.query_from_algebra = translateAlgebra(query_algebra)
    
    query_tree_2 = parser.parseQuery(self.query_from_algebra)
    query_algebra_2 = algebra.translateQuery(query_tree_2)
    self.query_from_query_from_algebra = translateAlgebra(query_algebra_2)
    _pprint_query(self.query_from_query_from_algebra)
    ```
    
    One test tried to also execute the query, but against a None valued
    variable. And then there was some exception handling in specific place.
    
    This change converts all of this to pytest using parameterization.
    
    There are two tests that fail, and seem to also fail in the old test
    structure, they are:
    
    ```python
    AlgebraTest(
        "test_other__service1",
        "Test if a nested service pattern is properly translated"
        "into the query text.",
        pytest.mark.xfail(raises=RecursionError),
    ),
    AlgebraTest(
        "test_property_path__negated_property_set",
        "Test if a negated property set gets properly translated into the query text.",
        pytest.mark.xfail(raises=TypeError, reason="fails in translateAlgebra"),
    ),
    ```
    
    The `test_other__service1` causes some more serious issues on Windows so
    it is guarded in a condition to only run it on non Windows operating
    systems.
    aucampia committed Dec 31, 2021
    Configuration menu
    Copy the full SHA
    203bcc2 View commit details
    Browse the repository at this point in the history
  2. Some cleanup

    - Rename the test data directory for `translate_algebra` to match other
      test data directories. (i.e. `test_translate_algebra` -> `translate_algebra`)
    - Remove `types-tabulate` form requirements.dev.txt as this was only
      used in the custom test framework.
    - Fix translate algebra docstring.
    - Add a TODO comment expressing the intent to evaluate algebra tests
      against a well defined graph and verify the result from the
      reconstituted query matches the result from the raw query.
    aucampia committed Dec 31, 2021
    Configuration menu
    Copy the full SHA
    f331ba9 View commit details
    Browse the repository at this point in the history