def test_space_linear(self): self.assertEqual(list(kc.space(1, 10, 10)), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) self.assertEqual(list(kc.space(1, 10, 3)), [1, 6, 10]) self.assertEqual(list(kc.space(1, 10, 9, endpoint=False)), [1, 2, 3, 4, 5, 6, 7, 8, 9]) self.assertEqual(list(kc.space(20, 40, 2)), [20, 40])
def test_space_log2(self): self.assertEqual(list(kc.space(1, 8, 4, log=True, base=2)), [1, 2, 4, 8]) self.assertEqual(list(kc.space(1, 16, 3, log=True, base=2)), [1, 4, 16]) self.assertEqual( list(kc.space(1, 4, 2, endpoint=False, log=True, base=2)), [1, 2]) self.assertEqual(list(kc.space(4, 8, 2, log=True, base=2)), [4, 8])
def test_space_log10(self): self.assertEqual(list(kc.space(1, 1000, 4, log=True)), [1, 10, 100, 1000]) self.assertEqual(list(kc.space(1, 10000, 3, log=True)), [1, 100, 10000]) self.assertEqual(list(kc.space(1, 100, 2, endpoint=False, log=True)), [1, 10]) self.assertEqual(list(kc.space(10, 100, 2, log=True)), [10, 100])
def test_space_log2(self): self.assertEqual(list(kc.space(1, 8, 4, log=True, base=2)), [1,2,4,8]) self.assertEqual(list(kc.space(1, 16, 3, log=True, base=2)), [1, 4, 16]) self.assertEqual(list(kc.space(1, 4, 2, endpoint=False, log=True, base=2)), [1,2]) self.assertEqual(list(kc.space(4, 8, 2, log=True, base=2)), [4, 8])
def test_space_log10(self): self.assertEqual(list(kc.space(1, 1000, 4, log=True)), [1,10,100,1000]) self.assertEqual(list(kc.space(1, 10000, 3, log=True)), [1, 100, 10000]) self.assertEqual(list(kc.space(1, 100, 2, endpoint=False, log=True)), [1,10]) self.assertEqual(list(kc.space(10, 100, 2, log=True)), [10, 100])
def test_space_linear(self): self.assertEqual(list(kc.space(1, 10, 10)), [1,2,3,4,5,6,7,8,9,10]) self.assertEqual(list(kc.space(1, 10, 3)), [1, 6, 10]) self.assertEqual(list(kc.space(1, 10, 9, endpoint=False)), [1,2,3,4,5,6,7,8,9]) self.assertEqual(list(kc.space(20, 40, 2)), [20, 40])