diff --git a/tests/0.D/test_pulse.py b/tests/0.D/test_pulse.py index 5e2207eb7a48fb96d60aca71e2e5f4cb70880dbb..47f4f1ccbb8e006ba313ab519b45ec2724876f1f 100644 --- a/tests/0.D/test_pulse.py +++ b/tests/0.D/test_pulse.py @@ -19,8 +19,8 @@ def test_pulse(set_color, time): pixel = Pixel(time) src.pulse.pulse(pixel, set_color, time) color, hist = pixel.look() - assert hist == [ + assert [ ((0, 0, 0), 0), (set_color, 1), ((0, 0, 0), 2), - ], "the pulse function should change color, wait, change color again, and wait again" + ] == hist, "the pulse function should change color, wait, change color again, and wait again" diff --git a/tests/0.D/test_translate_message.py b/tests/0.D/test_translate_message.py index d6840d2a7af8e3a61084318ea568a25251ddea3d..ac996f6a6521f92615e1845391b6a181f74ec89e 100644 --- a/tests/0.D/test_translate_message.py +++ b/tests/0.D/test_translate_message.py @@ -1,6 +1,7 @@ import pytest import os from src.morse_code import translate_message +from src.symbols import InvalidSymbolError from tests.helpers.translate_message_data import WHOLE_MESSAGE_TESTS from tests.helpers.naming import apply_names @@ -11,5 +12,8 @@ from tests.helpers.naming import apply_names apply_names("translate_message", [True, False], WHOLE_MESSAGE_TESTS), ) def test_decode_message(msg, expected): - result = translate_message(msg) - assert result == expected + try: + result = translate_message(msg) + assert expected == result + except InvalidSymbolError: + pytest.fail("translate_message should catch any InvalidSymbolError.") diff --git a/tests/1.C/test_prox_pulse.py b/tests/1.C/test_prox_pulse.py index d67579441b17bfb9833c8d736a2755f9b0588f0e..95c3c5cd93fd0fe016fe4fdc7b7d4a79d2075219 100644 --- a/tests/1.C/test_prox_pulse.py +++ b/tests/1.C/test_prox_pulse.py @@ -16,8 +16,8 @@ def test_prox_pulse(prox_val, set_color, duration): pixel = Pixel(duration) src.prox_pulse.prox_pulse(pixel, set_color, prox_val) color, hist = pixel.look() - assert hist == [ + assert [ ((0, 0, 0), 0), (set_color, 1), ((0, 0, 0), 2), - ], "the prox_pulse function should have pulsed the provided color" + ] == hist, "the prox_pulse function should have pulsed the provided color" diff --git a/tests/2.A/test_add_mark.py b/tests/2.A/test_add_mark.py index b2186ec4f763d529f0c0ecb1c079d59b417a1207..d2e77a2e81d95333343c0dfd349f248edf0eec15 100644 --- a/tests/2.A/test_add_mark.py +++ b/tests/2.A/test_add_mark.py @@ -7,5 +7,5 @@ from tests.helpers.naming import apply_names @pytest.mark.parametrize("interval, expected", apply_names('add_mark', [True, False], ADD_MARK_DATA)) def test_add_mark(interval, expected): mark = add_mark(interval) - assert mark == expected, "add_mark should have added the mark '" + \ + assert expected == mark, "add_mark should have added the mark '" + \ str(expected) + "', but you added '" + mark + "'" diff --git a/tests/2.A/test_set_color.py b/tests/2.A/test_set_color.py index e61708eaac4b2f3d3acf6716861b35097c05d18e..8a2488b81836b94b6845e0e3971f9a9dcb36b7e9 100644 --- a/tests/2.A/test_set_color.py +++ b/tests/2.A/test_set_color.py @@ -10,5 +10,5 @@ def test_set_color(interval, expected): pixel = Pixel(-1) set_color(interval, pixel) color, hist = pixel.look() - assert color == expected, "set_color should have changed the color to " + \ + assert expected == color, "set_color should have changed the color to " + \ str(expected) + ", but you changed it to " + str(color)