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