예제 #1
0
    def test__contains__(self):
        parent = Node()
        child = parent.descend('Child')
        parent.ctx['a'] = 1
        child.ctx['b'] = 2

        assert 'a' in parent.ctx
        assert 'a' in child.ctx
        assert 'b' in child.ctx
        assert 'b' not in parent.ctx
예제 #2
0
    def test__contains__(self):
        parent = Node()
        child = parent.descend('Child')
        parent.ctx['a'] = 1
        child.ctx['b'] = 2

        assert 'a' in parent.ctx
        assert 'a' in child.ctx
        assert 'b' in child.ctx
        assert 'b' not in parent.ctx
예제 #3
0
 def test_maps(self):
     parent = Node()
     child = parent.descend('Child')
     assert list(child.ctx.maps) == [child.ctx.map] + list(parent.ctx.maps)
예제 #4
0
    def test_eq(self):
        n1 = Node(a=1, b=2, c=3)
        n1.descend('Test1', x=1, y=2, z=3)

        n2 = Node(a=1, b=2, c=3)
        n2.descend('Test1', x=1, y=2, z=3)
예제 #5
0
 def test_clone_ne(self):
     n1 = Node(a=1, b=2, c=3)
     n1.descend('Test1', x=1, y=2, z=3)
     n2 = n1.clone(cow='moo')
     self.assertNotEqual(n1, n2)
예제 #6
0
 def test_clone_eq(self):
     n1 = Node(a=1, b=2, c=3)
     n1.descend('Test1', x=1, y=2, z=3)
     self.assertEqual(n1, n1.clone())
예제 #7
0
 def test_clone_eq(self):
     n1 = Node(a=1, b=2, c=3)
     n1.descend('Test1', x=1, y=2, z=3)
     self.assertEqual(n1, n1.clone())
예제 #8
0
 def test__repr__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     child.ctx['b'] = 2
     assert repr(child.ctx) == "{'b': 2} -> {'a': 1}"
예제 #9
0
 def test__iter__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     child.ctx['b'] = 2
     assert list(child.ctx) == list(child.ctx.map) + list(parent.ctx)
예제 #10
0
 def test__iter__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     child.ctx['b'] = 2
     assert list(child.ctx) == list(child.ctx.map) + list(parent.ctx)
예제 #11
0
 def test__len__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     child.ctx['b'] = 2
     assert len(child.ctx) is 2
예제 #12
0
 def test__delitem__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     del parent.ctx['a']
예제 #13
0
 def test_maps(self):
     parent = Node()
     child = parent.descend('Child')
     assert list(child.ctx.maps) == [child.ctx.map] + list(parent.ctx.maps)
예제 #14
0
    def test_eq(self):
        n1 = Node(a=1, b=2, c=3)
        n1.descend('Test1', x=1, y=2, z=3)

        n2 = Node(a=1, b=2, c=3)
        n2.descend('Test1', x=1, y=2, z=3)
예제 #15
0
 def test_clone_ne(self):
     n1 = Node(a=1, b=2, c=3)
     n1.descend('Test1', x=1, y=2, z=3)
     n2 = n1.clone(cow='moo')
     self.assertNotEqual(n1, n2)
예제 #16
0
 def test__delitem__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     del parent.ctx['a']
예제 #17
0
 def test__len__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     child.ctx['b'] = 2
     assert len(child.ctx) is 2
예제 #18
0
 def test__repr__(self):
     parent = Node()
     child = parent.descend('Child')
     parent.ctx['a'] = 1
     child.ctx['b'] = 2
     assert repr(child.ctx) == "{'b': 2} -> {'a': 1}"
예제 #19
0
 def test__init__(self):
     node = Node()
     node.ctx['a'] = 1
     child = node.descend('Child')
     newmap = ChainMap(inst=child)
     assert newmap['a'] == 1
예제 #20
0
 def test_ne(self):
     n1 = Node(a=1, b=2, c=3)
     n1.descend('Test1', x=1, y=2, z=3)
     n2 = Node(a=1, b=2, c=3)
     n2.descend('Test1', x=1, y=2, z=4)
     self.assertNotEqual(n1, n2)
예제 #21
0
 def test__init__(self):
     node = Node()
     node.ctx['a'] = 1
     child = node.descend('Child')
     newmap = ChainMap(inst=child)
     assert newmap['a'] == 1
예제 #22
0
 def test_ne(self):
     n1 = Node(a=1, b=2, c=3)
     n1.descend('Test1', x=1, y=2, z=3)
     n2 = Node(a=1, b=2, c=3)
     n2.descend('Test1', x=1, y=2, z=4)
     self.assertNotEqual(n1, n2)