Example #1
0
 def test_comma(self):
     t = cli.slice_type()
     r = t('37,42')
     assert_equal(r, [37, 42])
Example #2
0
 def test_zero_1(self):
     t = cli.slice_type(1)
     r = t('0')
     assert_equal(r, [0])
Example #3
0
 def test_positive_1(self):
     t = cli.slice_type(1)
     r = t('42')
     assert_equal(r, [42])
Example #4
0
 def test_non_int(self):
     t = cli.slice_type()
     with assert_raises(ValueError):
         t('')
     with assert_raises(ValueError):
         t('ham')
Example #5
0
 def test_negative(self):
     t = cli.slice_type()
     with assert_raises(ValueError):
         t('-42')
Example #6
0
 def test_plus_lt(self):
     t = cli.slice_type()
     with assert_raises(ValueError):
         t('42+-5')
Example #7
0
 def t(inp, exp):
     t = cli.slice_type()
     r = cli.get_slice_repr(inp)
     assert_equal(r, exp)
     assert_equal(t(r), inp)
Example #8
0
 def test_plus_eq(self):
     t = cli.slice_type()
     with assert_raises(ValueError):
         t('37+0')
Example #9
0
 def test_plus_1(self):
     t = cli.slice_type(1)
     with assert_raises(ValueError):
         t('37+5')
Example #10
0
 def test_plus(self):
     t = cli.slice_type()
     r = t('37+5')
     assert_equal(r, [37, 42])
Example #11
0
 def test_comma_lt(self):
     t = cli.slice_type()
     with assert_raises(ValueError):
         t('42,37')
Example #12
0
 def test_comma_1(self):
     t = cli.slice_type(1)
     with assert_raises(ValueError):
         t('37,42')