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 spinner.spin(8) assert spinner.position == 0 spinner.spin(100) assert spinner.position == 4 spinner.spin_randomly() assert spinner.position == 2 if __name__ == '__main__': import pytest pytest.main(['prep2_sample_test.py'])
def test_random() -> None: spinner = Spinner(8) spinner.spin_randomly() assert 0 <= spinner.position <= spinner.slots spinner.spin_randomly() assert 0 <= spinner.position <= spinner.slots spinner.spin_randomly() assert 0 <= spinner.position <= spinner.slots