Пример #1
0
 def test_multiple_variables(self):
     iterator = VariableIterator('${1} @{2} and %{3}', identifiers='$@%')
     assert_equal(list(iterator), [('', '${1}', ' @{2} and %{3}'),
                                   (' ', '@{2}', ' and %{3}'),
                                   (' and ', '%{3}', '')])
     assert_equal(bool(iterator), True)
     assert_equal(len(iterator), 3)
Пример #2
0
 def test_can_be_iterated_many_times(self):
     iterator = VariableIterator('one ${var} here', identifiers='$')
     assert_equal(list(iterator), [('one ', '${var}', ' here')])
     assert_equal(list(iterator), [('one ', '${var}', ' here')])
     assert_equal(bool(iterator), True)
     assert_equal(bool(iterator), True)
     assert_equal(len(iterator), 1)
     assert_equal(len(iterator), 1)
Пример #3
0
 def test_one_variable(self):
     iterator = VariableIterator('one ${var} here', identifiers='$')
     assert_equal(list(iterator), [('one ', '${var}', ' here')])
     assert_equal(bool(iterator), True)
     assert_equal(len(iterator), 1)
Пример #4
0
 def test_no_variables(self):
     iterator = VariableIterator('no vars here', identifiers='$')
     assert_equal(list(iterator), [])
     assert_equal(bool(iterator), False)
     assert_equal(len(iterator), 0)