def test_comma(self): t = cli.slice_type() r = t('37,42') assert_equal(r, [37, 42])
def test_zero_1(self): t = cli.slice_type(1) r = t('0') assert_equal(r, [0])
def test_positive_1(self): t = cli.slice_type(1) r = t('42') assert_equal(r, [42])
def test_non_int(self): t = cli.slice_type() with assert_raises(ValueError): t('') with assert_raises(ValueError): t('ham')
def test_negative(self): t = cli.slice_type() with assert_raises(ValueError): t('-42')
def test_plus_lt(self): t = cli.slice_type() with assert_raises(ValueError): t('42+-5')
def t(inp, exp): t = cli.slice_type() r = cli.get_slice_repr(inp) assert_equal(r, exp) assert_equal(t(r), inp)
def test_plus_eq(self): t = cli.slice_type() with assert_raises(ValueError): t('37+0')
def test_plus_1(self): t = cli.slice_type(1) with assert_raises(ValueError): t('37+5')
def test_plus(self): t = cli.slice_type() r = t('37+5') assert_equal(r, [37, 42])
def test_comma_lt(self): t = cli.slice_type() with assert_raises(ValueError): t('42,37')
def test_comma_1(self): t = cli.slice_type(1) with assert_raises(ValueError): t('37,42')