jhanarato / uposatha-inky

Display the uposatha on a Pimoroni Inky display
MIT License
0 stars 0 forks source link

Test suggestion from MissArticulatePython #4

Closed jhanarato closed 1 year ago

jhanarato commented 1 year ago

Must have a look at this when rested:

def test_should_split_sequence_into_two_rows():
    result = seq_to_rows(seq=[1, 2, 3, 4], row_length=2)
    assert result == [[1, 2], [3, 4]], f"result: {result}"

def test_should_split_sequence_with_smaller_first_row():
    result = seq_to_rows(seq=[1, 2, 3], row_length=2)
    assert result == [[1], [2, 3]], f"result: {result}"

def test_should_handle_sequence_equal_to_row_length():
    result = seq_to_rows(seq=[1, 2, 3], row_length=3)
    assert result == [[1, 2, 3]], f"result: {result}"

def test_should_handle_sequence_smaller_than_row_length():
    result = seq_to_rows(seq=[1, 2, 3], row_length=4)
    assert result == [[1, 2, 3]], f"result: {result}"
jhanarato commented 1 year ago

Not sure why we need the message. When I break the test I get this:

FAILED       [ 45%]
test_countdown.py:133 (test_should_split_sequence_into_two_rows)
[[1, 2], [3, 4]] != [[0, 2], [3, 4]]

Expected :[[0, 2], [3, 4]]
Actual   :[[1, 2], [3, 4]]
<Click to see difference>

def test_should_split_sequence_into_two_rows():
        result = seq_to_rows(seq=[1, 2, 3, 4], row_length=2)
>       assert result == [[0, 2], [3, 4]]
E       assert [[1, 2], [3, 4]] == [[0, 2], [3, 4]]
E         At index 0 diff: [1, 2] != [0, 2]
E         Full diff:
E         - [[0, 2], [3, 4]]
E         ?   ^
E         + [[1, 2], [3, 4]]
E         ?   ^

test_countdown.py:136: AssertionError

Actual is set to result. Seems ok?