def test_grid_has_getter_and_return_tuple(): bat = Batman(width=4, height=5) correct_values = [ (0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), ] assert bat.get() == correct_values
def test_grid_return_expected_white_bat_if_direction_is_up_and_right(): bat = Batman(width=8, height=8, bat_x=3, bat_y=3) bat.set("UR") white_gird = bat.get() correct_values = set([(7, 3), (5, 1), (7, 0), (7, 1), (6, 1), (4, 0), (6, 0), (5, 2), (6, 3), (6, 2), (5, 0), (4, 3), (4, 2), (4, 1), (7, 2), (5, 3)]) assert correct_values == set(white_gird)
def test_bat_return_expected_white_bat_if_direction_is_up(): bat = Batman(width=4, height=4, bat_x=3, bat_y=2) bat.set("U") white_gird = bat.get() assert set(white_gird) == set([ (0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2), (3, 0), (3, 1), (3, 2), ])
def test_bat_return_expected_white_bat_if_direction_is_down(): bat = Batman(width=4, height=4, bat_x=3, bat_y=2) bat.set("D") white_gird = bat.get() assert set(white_gird) == set([(0, 3), (1, 3), (2, 3), (3, 3)])
def test_if_jump_return_is_present_on_white_bat(): bat = Batman(width=4, height=4, bat_x=3, bat_y=2) white_gird = bat.get() value = bat.jump() assert value in white_gird