Esempio n. 1
0
 def test_context_flocked_object(self):
     obj = flock({'one': {'two': lambda: 3, 'three': 4}})
     assert get_context(obj) == obj
     assert get_context(obj.one) == obj
     assert get_context(obj.one.two) == obj
Esempio n. 2
0
 def test_flock_nested_object(self):
     Class = type(str('Class'), (object, ), {})
     obj = flock({'attr': Class()})
     assert isinstance(obj.attr, Class)
Esempio n. 3
0
 def test_flock_unflock(self):
     definition = {'one': {'two': {'three': self.func}}}
     assert unflock(flock(definition)) == definition
Esempio n. 4
0
 def test_flock_nested_attributes(self):
     obj = flock({'one': {'two': {'three': 1, 'four': [1, {'five': 5}]}}})
     assert obj.one.two.three == 1
     assert obj.one.two.four == [1, {'five': 5}]
Esempio n. 5
0
 def test_flock_nested_methods(self):
     obj = flock({'one': {'two': {'three': self.func}}})
     assert six.callable(obj.one.two.three)
     assert isinstance(obj.one.two.three, type(obj.one.two.three))
     assert obj.one.two.three() == 1
Esempio n. 6
0
 def test_flock_flat_attribute(self):
     assert flock({'one': 1}).one == 1
Esempio n. 7
0
 def test_flock_flat_method(self):
     obj = flock({'one': self.func})
     assert six.callable(obj.one)
     assert isinstance(obj.one, type(self.func))
     assert obj.one() == 1
Esempio n. 8
0
 def test_flock_unflock(self):
     definition = {'one': {'two': {'three': self.func}}}
     assert unflock(flock(definition)) == definition
Esempio n. 9
0
 def test_context_flocked_object(self):
     obj = flock({'one': {'two': lambda: 3, 'three': 4}})
     assert get_context(obj) == obj
     assert get_context(obj.one) == obj
     assert get_context(obj.one.two) == obj
Esempio n. 10
0
 def test_flock_nested_object(self):
     Class = type(str('Class'), (object,), {})
     obj = flock({'attr': Class()})
     assert isinstance(obj.attr, Class)
Esempio n. 11
0
 def test_flock_nested_methods(self):
     obj = flock({'one': {'two': {'three': self.func}}})
     assert six.callable(obj.one.two.three)
     assert isinstance(obj.one.two.three, type(obj.one.two.three))
     assert obj.one.two.three() == 1
Esempio n. 12
0
 def test_flock_nested_attributes(self):
     obj = flock({'one': {'two': {'three': 1, 'four': [1, {'five': 5}]}}})
     assert obj.one.two.three == 1
     assert obj.one.two.four == [1, {'five': 5}]
Esempio n. 13
0
 def test_flock_flat_method(self):
     obj = flock({'one': self.func})
     assert six.callable(obj.one)
     assert isinstance(obj.one, type(self.func))
     assert obj.one() == 1
Esempio n. 14
0
 def test_flock_flat_attribute(self):
     assert flock({'one': 1}).one == 1