Beispiel #1
0
def test_check_for_tree():
    with open(f"{TEST_FILE_PATH}/test_input.txt") as f:
        test_map = f.read().splitlines()
    test_tt = TobogganTrajectory(input_map=test_map)
    test_tt.current_x = 4
    test_tt.current_y = 1
    test_tt.check_for_tree()
    assert test_tt.trees_found == 1
Beispiel #2
0
def test_out_of_boundary_extend_called():
    mocked_extend = mock.Mock()
    with open(f"{TEST_FILE_PATH}/test_input.txt") as f:
        test_map = f.read().splitlines()
    with mock.patch.object(TobogganTrajectory, "extend_map", mocked_extend):
        test_tt = TobogganTrajectory(input_map=test_map, move_x=3, move_y=1)
        test_tt.current_x = test_tt.boundary
        test_tt.move()
    assert mocked_extend.call_count == 1