Ejemplo n.º 1
0
 def test_example_input(self):
     chart = SeatingChart(3, 11)
     chart.initialize([(1, 4), (1, 6), (2, 3), (2, 7), (3, 9), (3, 10)])
     chart._find_seats(3)
     chart._find_seats(3)
     chart._find_seats(3)
     chart._find_seats(1)
     chart._find_seats(10)
     expected = {
         300002: 1,
         400001: 1,
         400002: 1,
         500001: 1,
         500002: 1,
         500003: 1,
         600001: 1,
         600002: 1,
         600003: 1,
         700001: 1,
         700002: 1,
         700003: 1,
         800001: 1,
         900001: 1,
         900003: 1,
         1000003: 1
     }
     actual = chart._reserved_seats
     assert expected == actual
Ejemplo n.º 2
0
 def test_find_best_five_seats_in_second_row(self):
     chart = SeatingChart(5, 10)
     chart.initialize([(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
                       (1, 7), (1, 8), (1, 9), (1, 10)])
     chart._find_seats(5)
     expected = {
         400001: 1,
         200001: 1,
         100001: 1,
         900001: 1,
         700001: 1,
         600001: 1,
         500001: 1,
         300001: 1,
         1000001: 1,
         800001: 1,
         300002: 1,
         400002: 1,
         500002: 1,
         600002: 1,
         700002: 1
     }
     actual = chart._reserved_seats
     assert expected == actual
Ejemplo n.º 3
0
 def test_initializing_with_out_of_bound_values(self):
     chart = SeatingChart(5, 5)
     with pytest.raises(KeyError):
         chart.initialize([(1, 2), (1, 7)])
Ejemplo n.º 4
0
 def test_no_space_left_for_group(self):
     chart = SeatingChart(2, 6)
     chart.initialize([(1, 1), (1, 3), (1, 5), (2, 2), (2, 4), (2, 6)])
     expected = None
     actual = chart._find_seats(2)
     assert actual == expected