Пример #1
0
 def test_variable(self):
     scoped_id = 'var_foo_1'
     self._registry.push_new_scope({'foo': (scoped_id, False)})
     v = Variable('foo')
     v_id = v.add_to_rules(self._rules, self._registry)
     self.assertEqual(v_id, scoped_id)
     self.assertEqual([], self._rules.instance_of_calls)
Пример #2
0
 def test_polymorphic_variable(self):
     scoped_id = 'var_foo_1'
     self._registry.push_new_scope({'foo': (scoped_id, True)})
     v = Variable('foo')
     v_id = v.add_to_rules(self._rules, self._registry)
     self.assertIn((v_id, scoped_id), self._rules.instance_of_calls)
Пример #3
0
 def test_polymorphic_variable(self):
     self._registry.push_new_scope({'foo': ('var_foo_1', True)})
     v = Variable('foo')
     v_id = v.add_to_rules(self._rules, self._registry)
     self.assertEqual(Result({}, {}), self._rules.infer())