Beispiel #1
0
 def test_basic_ids(self):
     """ Test starting ids """
     ids1 = generators.generator_basic_ids()
     ids2 = generators.generator_basic_ids()
     self.generator_repeat_test(ids1)
     self.generator_repeat_test(ids2)
     self.assertEqual(next(ids1), next(ids2))
Beispiel #2
0
 def test_basic_ids(self):
     """ Test starting ids """
     ids1 = generators.generator_basic_ids()
     ids2 = generators.generator_basic_ids()
     self.generator_repeat_test(ids1)
     self.generator_repeat_test(ids2)
     self.assertEqual(ids1.next(), ids2.next())
Beispiel #3
0
    def test_update_context_generators(self):
        """ Test updating context variables using generator """
        test = Test()
        context = Context()
        context.bind_variable('foo', 'broken')
        test.variable_binds = {'foo': 'initial_value'}
        test.generator_binds = {'foo': 'gen'}
        context.add_generator('gen', generators.generator_basic_ids())

        test.update_context_before(context)
        self.assertEqual(1, context.get_value('foo'))
        test.update_context_before(context)
        self.assertEqual(2, context.get_value('foo'))
Beispiel #4
0
    def test_update_context_generators(self):
        """ Test updating context variables using generator """
        test = Test()
        context = Context()
        context.bind_variable('foo', 'broken')
        test.variable_binds = {'foo': 'initial_value'}
        test.generator_binds = {'foo': 'gen'}
        context.add_generator('gen', generators.generator_basic_ids())

        test.update_context_before(context)
        self.assertEqual(1, context.get_value('foo'))
        test.update_context_before(context)
        self.assertEqual(2, context.get_value('foo'))