def test_multiple_rangewcomma(self): fr = FormattedRange("a[1-2,4-5]b[6-7,9-10]c") exp_len = 16 not_expected = ['a3b', 'b8c'] res = fr.get() eq_(len(res), exp_len) for i in not_expected: ok_(i not in res)
def test_rangewcomma(self): fr = FormattedRange("a[1-2,4-5]b") expected = ['a1b', 'a2b', 'a4b', 'a5b'] eq_(fr.get(), expected)
def test_range_formatted(self): # Use 2 digits numbers formatting fr = FormattedRange("a[01-%s]b" % self._max) for n, i in enumerate(fr.get()): eq_(i, "a%02db" % (n + 1))
def test_multiple_range(self): fr = FormattedRange("a[1-%s]b[1-%s]c" % (2,3)) expected = ['a1b1c', 'a1b2c', 'a1b3c', 'a2b1c', 'a2b2c', 'a2b3c'] eq_(fr.get(), expected)
def test_range_normal(self): fr = FormattedRange("a[1-%s]b" % self._max) for n, i in enumerate(fr.get()): eq_(i, "a%db" % (n + 1))