def test_get_distribution_markers_insufficient_markers(self): expected = ['b', 'g', 'r', 'c', 'm', 'y', 'w', 'b', 'g', 'r'] # adapted from SO example here: http://stackoverflow.com/a/3892301 with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") actual = _get_distribution_markers('colors', None, 10) self.assertTrue(issubclass(w[-1].category, RuntimeWarning)) self.assertEqual(actual, expected) expected = ['^', '>', '<', '^', '>'] with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") actual = _get_distribution_markers('symbols', ['^', '>', '<'], 5) self.assertTrue(issubclass(w[-1].category, RuntimeWarning)) self.assertEqual(actual, expected)
def test_get_distribution_markers_bad_marker_type(self): with npt.assert_raises(ValueError): _get_distribution_markers('shapes', [], 3)
def test_get_distribution_markers_empty_marker_list(self): self.assertEqual(_get_distribution_markers('colors', None, 4), ['b', 'g', 'r', 'c'])
def test_get_distribution_markers_null_marker_list(self): self.assertEqual(_get_distribution_markers('colors', None, 5), ['b', 'g', 'r', 'c', 'm'])
def test_get_distribution_markers_negative_num_markers(self): with npt.assert_raises(ValueError): _get_distribution_markers('symbols', [], -1)
def test_get_distribution_markers_zero_markers(self): self.assertEqual(_get_distribution_markers('symbols', None, 0), []) self.assertEqual(_get_distribution_markers('symbols', ['^'], 0), [])
def test_get_distribution_markers_bad_marker_type(self): with npt.assert_raises(ValueError): _get_distribution_markers('shapes', [], 3)
def test_get_distribution_markers_zero_markers(self): """_get_distribution_markers() should return an empty list.""" self.assertEqual(_get_distribution_markers('symbols', None, 0), []) self.assertEqual(_get_distribution_markers('symbols', ['^'], 0), [])
def test_get_distribution_markers_empty_marker_list(self): self.assertEqual(_get_distribution_markers('colors', None, 4), ['b', 'g', 'r', 'c'])
def test_get_distribution_markers_null_marker_list(self): self.assertEqual(_get_distribution_markers('colors', None, 5), ['b', 'g', 'r', 'c', 'm'])
def test_get_distribution_markers_zero_markers(self): self.assertEqual(_get_distribution_markers("symbols", None, 0), []) self.assertEqual(_get_distribution_markers("symbols", ["^"], 0), [])
def test_get_distribution_markers_empty_marker_list(self): self.assertEqual(_get_distribution_markers("colors", None, 4), ["b", "g", "r", "c"])
def test_get_distribution_markers_null_marker_list(self): self.assertEqual(_get_distribution_markers("colors", None, 5), ["b", "g", "r", "c", "m"])
def test_get_distribution_markers_zero_markers(self): """_get_distribution_markers() should return an empty list.""" self.assertEqual(_get_distribution_markers('symbols', None, 0), []) self.assertEqual(_get_distribution_markers('symbols', ['^'], 0), [])
def test_get_distribution_markers_empty_marker_list(self): """_get_distribution_markers() should return a list of predefined matplotlib markers.""" self.assertEqual(_get_distribution_markers('colors', None, 4), ['b', 'g', 'r', 'c'])
def test_get_distribution_markers_zero_markers(self): self.assertEqual(_get_distribution_markers('symbols', None, 0), []) self.assertEqual(_get_distribution_markers('symbols', ['^'], 0), [])
def test_get_distribution_markers_negative_num_markers(self): with npt.assert_raises(ValueError): _get_distribution_markers('symbols', [], -1)
def test_get_distribution_markers_empty_marker_list(self): """_get_distribution_markers() should return a list of predefined matplotlib markers.""" self.assertEqual(_get_distribution_markers('colors', None, 4), ['b', 'g', 'r', 'c'])