コード例 #1
0
 def test_returns_correct_row_positions(self) -> None:
     test_positions = [
         (0, 0, 10, 10),
         (15, 0, 25, 10),
         (30, 0, 40, 10),
         (45, 0, 55, 10),
         (60, 0, 70, 10),
         (0, 15, 10, 25),
         (15, 15, 25, 25),
         (30, 15, 40, 25),
         (45, 15, 55, 25),
         (60, 15, 70, 25),
         (0, 30, 10, 40),
         (15, 30, 25, 40),
         (30, 30, 40, 40),
         (45, 30, 55, 40),
         (60, 30, 70, 40),
         (0, 45, 10, 55),
         (15, 45, 25, 55),
         (30, 45, 40, 55),
         (45, 45, 55, 55),
         (60, 45, 70, 55),
         (0, 60, 10, 70),
         (15, 60, 25, 70),
         (30, 60, 40, 70),
         (45, 60, 55, 70),
         (60, 60, 70, 70),
     ]
     actual = determine_row_positions(*test_positions)
     expected = [(60, 70), (45, 55), (30, 40), (15, 25), (0, 10)]
     assert actual == expected
コード例 #2
0
    def test_returns_atleast_one_row(self) -> None:
        test_positions = [(0, 5, 10, 25), (15, 0, 25, 20), (30, 5, 40, 25),
                          (45, 0, 55, 20), (60, 5, 70, 25)]
        actual = determine_row_positions(*test_positions)
        expected = [(0, 25)]

        assert len(actual) == 1
        assert actual == expected
コード例 #3
0
 def test_returns_correct_row_positions_when_working_with_borders(
         self, border) -> None:
     expected = [(706.0, 719.5), (692.2, 705.5), (678.2, 691.7),
                 (664.2, 677.7), (650.2, 663.7), (636.5, 649.7)]
     actual = determine_row_positions(border)
     assert positionsAlmostEqual(actual, expected, delta=5)
コード例 #4
0
 def test_returns_list_of_tuples(self, table_borders) -> None:
     result = determine_row_positions(table_borders[0])
     assert isinstance(result, list)
     for position in result:
         assert isinstance(position, tuple)
コード例 #5
0
 def test_returns_list_of_tuples(self) -> None:
     test_positions = [(0, 0, 10, 10), (10, 10, 10, 10)]
     result = determine_row_positions(*test_positions)
     assert isinstance(result, list)
     assert all(map(lambda e: isinstance(e, tuple), result))