コード例 #1
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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
コード例 #2
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 def test_flock_nested_object(self):
     Class = type(str('Class'), (object, ), {})
     obj = flock({'attr': Class()})
     assert isinstance(obj.attr, Class)
コード例 #3
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 def test_flock_unflock(self):
     definition = {'one': {'two': {'three': self.func}}}
     assert unflock(flock(definition)) == definition
コード例 #4
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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}]
コード例 #5
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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
コード例 #6
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 def test_flock_flat_attribute(self):
     assert flock({'one': 1}).one == 1
コード例 #7
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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
コード例 #8
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 def test_flock_unflock(self):
     definition = {'one': {'two': {'three': self.func}}}
     assert unflock(flock(definition)) == definition
コード例 #9
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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
コード例 #10
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 def test_flock_nested_object(self):
     Class = type(str('Class'), (object,), {})
     obj = flock({'attr': Class()})
     assert isinstance(obj.attr, Class)
コード例 #11
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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
コード例 #12
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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}]
コード例 #13
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 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
コード例 #14
0
ファイル: flock_test.py プロジェクト: arhoyling/cuckoos
 def test_flock_flat_attribute(self):
     assert flock({'one': 1}).one == 1