PyTest: compare strings
Comparing short strings also work relatively well as we humans will be able to read the error report.
def get_string():
return "abc"
def test_get_string():
assert get_string() == "abd"
$ pytest -q test_string_equal.py
Output:
F [100%]
=================================== FAILURES ===================================
_______________________________ test_get_string ________________________________
def test_get_string():
> assert get_string() == "abd"
E AssertionError: assert 'abc' == 'abd'
E
E - abd
E + abc
test_string_equal.py:5: AssertionError
=========================== short test summary info ============================
FAILED test_string_equal.py::test_get_string - AssertionError: assert 'abc' =...
1 failed in 0.04s