예제 #1
0
def test2_doctest() -> None:
    """Test the given doctest in the Spinner class docstring."""
    spinner = Spinner(12)

    spinner.spin(12)
    assert spinner.position == 0

    spinner.spin(13)
    assert spinner.position == 1

    spinner.spin(5)
    assert spinner.position == 6

    spinner.spin(0)
    assert spinner.position == 6
예제 #2
0
def test_size_2_doctest() -> None:
    """Test the given doctest in the Spinner class docstring."""
    spinner = Spinner(2)

    spinner.spin(2)
    assert spinner.position == 0

    spinner.spin(1)
    assert spinner.position == 1

    spinner.spin(6)
    assert spinner.position == 1
예제 #3
0
def test3_doctest() -> None:
    """Test the given doctest in the Spinner class docstring."""
    spinner = Spinner(1)

    spinner.spin(0)
    assert spinner.position == 0

    spinner.spin(1)
    assert spinner.position == 0

    spinner.spin(2)
    assert spinner.position == 0
예제 #4
0
def test_doctest() -> None:
    """Test the given doctest in the Spinner class docstring."""
    spinner = Spinner(8)

    spinner.spin(4)
    assert spinner.position == 4

    spinner.spin(2)
    assert spinner.position == 6

    spinner.spin(2)
    assert spinner.position == 0
예제 #5
0
def test_new_spinner_position(slots: int) -> None:
    """Test that the position of a new spinner is always 0."""
    spinner = Spinner(slots)
    assert spinner.position == 0
예제 #6
0
def test_random_doctest2() -> None:
    spinner = Spinner(3)
    spinner.spin(4)
    spinner.spin_randomly()
    assert spinner.position == 1
예제 #7
0
def test_random_doctest() -> None:
    spinner = Spinner(2)
    spinner.spin_randomly()
    assert spinner.position in [0, 1]