Пример #1
0
    def test_evaluation_of_lifo(self):
        environment = Environment()
        queue = LIFO()

        Evaluation(environment, queue, Factory()).result

        queue = environment.look_up(Symbols.QUEUE).delegate
        self.assertIsInstance(queue, LIFOTaskPool)
Пример #2
0
    def test_evaluation_of_lifo(self):
        environment = Environment()
        queue = LIFO()

        Evaluation(environment, queue, Factory()).result

        queue = environment.look_up(Symbols.QUEUE).delegate
        self.assertIsInstance(queue, LIFOTaskPool)
Пример #3
0
    def test_look_up_masked_bindings(self):
        env1 = Environment()
        env1.define("my_var", 8)
        env2 = env1.create_local_environment()
        env2.define("my_var", 7)
        env3 = env2.create_local_environment()
        env3.define("my_var", 6)

        self.assertEqual(env1.look_up("my_var"), 8)
        self.assertEqual(env2.look_up("my_var"), 7)
        self.assertEqual(env3.look_up("my_var"), 6)
Пример #4
0
    def test_look_up_masked_bindings(self):
        env1 = Environment()
        env1.define("my_var", 8)
        env2 = env1.create_local_environment()
        env2.define("my_var", 7)
        env3 = env2.create_local_environment()
        env3.define("my_var", 6)

        self.assertEqual(env1.look_up("my_var"), 8)
        self.assertEqual(env2.look_up("my_var"), 7)
        self.assertEqual(env3.look_up("my_var"), 6)
Пример #5
0
 def test_look_up_a_missing_binding(self):
     env1 = Environment()
     env1.define("var1", 5)
     self.assertIsNone(env1.look_up("missing_symbol"))
Пример #6
0
 def test_look_up_a_missing_binding(self):
     env1 = Environment()
     env1.define("var1", 5)
     self.assertIsNone(env1.look_up("missing_symbol"))