Skip to content

Commit

Permalink
Reverse order of cli test assertions
Browse files Browse the repository at this point in the history
PyTest generates diffs for the expected vs actual values on the
assumption that the expected value is on the right of the comparison.
  • Loading branch information
tpoliaw committed Jul 8, 2024
1 parent 8e09ea3 commit 06daa87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,21 +613,21 @@ def test_unknown_object_formatting():
output = StringIO()
OutputFormat.JSON.display(demo, output)
exp = """{"foo": 42, "bar": ["hello", "World"]}\n"""
assert exp == output.getvalue()
assert output.getvalue() == exp

output = StringIO()
OutputFormat.COMPACT.display(demo, output)
exp = """{'bar': ['hello', 'World'], 'foo': 42}\n"""
assert exp == output.getvalue()
assert output.getvalue() == exp

output = StringIO()
OutputFormat.FULL.display(demo, output)
assert exp == output.getvalue()
assert output.getvalue() == exp


def test_generic_base_model_formatting():
output = StringIO()
obj = ExtendedModel(name="foo", keys=[1, 2, 3], metadata={"fizz": "buzz"})
exp = '{"name": "foo", "keys": [1, 2, 3], "metadata": {"fizz": "buzz"}}\n'
OutputFormat.JSON.display(obj, output)
assert exp == output.getvalue()
assert output.getvalue() == exp

0 comments on commit 06daa87

Please sign in to comment.