Пример #1
0
def test_data_rotation(sample_cube: Cube) -> None:
    orientation = Orientation(Side.FRONT, Side.TOP)
    sample_cube.set_data(orientation, 0, 2, "b")
    sample_cube.set_data(orientation, 1, 2, "a")
    sample_cube.turn_vertical(orientation, 3, 1)

    def get_side(orient: Orientation) -> str:
        return data_to_string(sample_cube.get_side(orient))

    assert get_side(
        orientation) == "None None None/None None None/None None None"
    assert get_side(
        orientation.to_right) == "None a b/None None None/None None None"
    assert get_side(
        orientation.to_top) == "None None b/None None a/None None None"
Пример #2
0
def test_data_set(sample_cube: Cube) -> None:
    orientation = Orientation(Side.RIGHT, Side.BACK)

    sample_cube.set_data(orientation, 1, 1, "a")
    sample_cube.set_data(orientation, 0, 0, "b")
    sample_cube.set_data(orientation, 1, 2, "c")
    sample_cube.set_data(orientation, 2, 1, "d")

    def get_side(orient: Orientation) -> str:
        return data_to_string(sample_cube.get_side(orient))

    orientation = Orientation(Side.FRONT, Side.TOP)
    assert get_side(orientation) == "None None None/None None d/None None None"
    assert get_side(
        orientation.to_top) == "None None b/None None None/None None None"
    assert get_side(orientation.to_right) == "None None b/d a None/None c None"
    assert get_side(orientation.to_right.to_right
                    ) == "b None None/None None None/None None None"
    assert get_side(
        orientation.to_bottom) == "None None None/None None c/None None None"