示例#1
0
def test_swap_swaps_two_tiles():

    output_sheet = [[2, 1]]
    test_map = Map([[1, 2]], [[1, 2]], [[1, 2]], [[1, 2]], validate=False)

    test_map.swap((0, 0), (1, 0), Map.FOREGROUND_SHEET_INDEX)
    test_map.swap((0, 0), (1, 0), Map.CHARACTER_SHEET_INDEX)
    test_map.swap((0, 0), (1, 0), Map.PATH_SHEET_INDEX)
    test_map.swap((0, 0), (1, 0), Map.BACKGROUND_SHEET_INDEX)

    assert test_map.tile_sheets == (
        list(output_sheet),
        list(output_sheet),
        list(output_sheet),
        list(output_sheet),
    )
示例#2
0
def test_swap_done_on_sheet_greater_than_3_raises_value_error():
    test_map = Map([[1, 2]], [[1, 2]], [[1, 2]], [[1, 2]], validate=False)

    with pytest.raises(ValueError):
        test_map.swap((0, 1), (0, 1), Map.BACKGROUND_SHEET_INDEX + 1)
示例#3
0
def test_swap_done_on_sheet_less_than_0_raises_value_error():
    test_map = Map([[1, 2]], [[1, 2]], [[1, 2]], [[1, 2]], validate=False)

    with pytest.raises(ValueError):
        test_map.swap((0, 1), (0, 1), Map.FOREGROUND_SHEET_INDEX - 1)