grc: Clean up test_expr_utils.py

Signed-off-by: Håkon Vågsether <hauk142@gmail.com>
This commit is contained in:
Håkon Vågsether 2021-01-05 21:12:42 +01:00 committed by Martin Braun
parent 8258d81478
commit 00ba382e24

View File

@ -8,7 +8,6 @@ id_getter = operator.itemgetter(0)
expr_getter = operator.itemgetter(1)
@pytest.mark.xfail(reason="core/utils/expr_utils.py:97: TypeError: '<' not supported between instances of 'NoneType' and 'str'")
def test_simple():
objects = [
['c', '2 * a + b'],
@ -18,26 +17,24 @@ def test_simple():
]
expected = [
['a', '1'],
['d', '5'],
['a', '1'],
['b', '2 * a + unknown * d'],
['c', '2 * a + b'],
]
out = expr_utils.sort_objects2(objects, id_getter, expr_getter)
out = expr_utils.sort_objects(objects, id_getter, expr_getter)
assert out == expected
@pytest.mark.xfail(reason="core/utils/expr_utils.py:97: TypeError: '<' not supported between instances of 'NoneType' and 'str'")
def test_other():
def test_circular():
test = [
['c', '2 * a + b'],
['a', '1'],
['b', '2 * c + unknown'],
]
expr_utils.sort_objects2(test, id_getter, expr_getter, check_circular=False)
with pytest.raises(RuntimeError):
expr_utils.sort_objects2(test, id_getter, expr_getter)
# Should fail due to circular dependency
with pytest.raises(Exception):
expr_utils.sort_objects(test, id_getter, expr_getter)