Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_contains(self):
scale = leather.Ordinal(['a', 'b', 'c', 'd'])
self.assertTrue(scale.contains('a'))
self.assertFalse(scale.contains('aa'))
self.assertFalse(scale.contains('e'))
self.assertFalse(scale.contains(5))
def test_ticks(self):
scale = leather.Ordinal(['a', 'b', 'c', 'd'])
self.assertEqual(scale.ticks(), ['a', 'b', 'c', 'd'])
def test_project_interval(self):
scale = leather.Ordinal(['a', 'b', 'c', 'd'])
self.assertEqual(scale.project_interval('b', 0, 20), (5.25, 9.75))
scale = leather.Ordinal(['a', 'd', 'c', 'b'])
self.assertEqual(scale.project_interval('b', 0, 20), (15.25, 19.75))
def setUp(self):
self.shape = leather.Columns('red')
self.linear = leather.Linear(0, 10)
self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
self.palette = (color for color in ['red', 'white', 'blue'])
def setUp(self):
self.shape = leather.Bars('red')
self.linear = leather.Linear(0, 10)
self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
self.palette = (color for color in ['red', 'white', 'blue'])
def test_project_interval(self):
scale = leather.Ordinal(['a', 'b', 'c', 'd'])
self.assertEqual(scale.project_interval('b', 0, 20), (5.25, 9.75))
scale = leather.Ordinal(['a', 'd', 'c', 'b'])
self.assertEqual(scale.project_interval('b', 0, 20), (15.25, 19.75))
def setUp(self):
self.shape = leather.Dots('red')
self.linear = leather.Linear(0, 10)
self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
self.palette = (color for color in ['red', 'white', 'blue'])
def test_project(self):
scale = leather.Ordinal(['a', 'b', 'c', 'd'])
self.assertEqual(scale.project('b', 0, 20), 7.5)
scale = leather.Ordinal(['a', 'd', 'c', 'b'])
self.assertEqual(scale.project('b', 0, 20), 17.5)