def test_random_palette_rgb_mode_many_colours_called_that_many_times( mocked_method): colours.random_palette(100, mode="RGB") expected_call = 100 assert ( mocked_method.call_count == expected_call ), f"random_saturation was called {mocked_method.call_count} times, should have been {expected_call}"
def test_random_palette_default_generator_many_colours_called_that_many_times( mocked_method): colours.random_palette(100) expected_call = 100 assert ( mocked_method.call_count == expected_call ), f"random_saturation was called {mocked_method.call_count} times, should have been {expected_call}"
def test_random_palette_default_generator_with_one_colour_expected_result(): assert len(colours.random_palette(1)) == 1
def test_random_palette_default_generator_with_one_colour_called_once( mocked_method): colours.random_palette(1) mocked_method.assert_called_once_with()
def test_random_palette_default_generator_zero_colours_expected_result(): with pytest.raises(colours.ColourError): colours.random_palette(0)
def test_random_palette_rgb_mode_with_many_colours_expected_result(): assert len(colours.random_palette(11, mode="RGB")) == 11
def test_random_palette_rgb_mode_with_one_colour_called_once(mocked_method): colours.random_palette(1, mode="RGB") mocked_method.assert_called_once_with()
def test_random_palette_l_mode_with_one_colour_expected_result(): assert len(colours.random_palette(1, mode="L")) == 1
def test_random_palette_rgb_mode_zero_colours_expected_result(): with pytest.raises(colours.ColourError): colours.random_palette(0)