Esempio n. 1
0
    def testEdgeField(self):
        x_ref = NamedRef(None, 'x', Env.x)
        self.assertReq(x_ref,
                       Edge([Link('x', Edge([]))]))

        a_ref = NamedRef(x_ref, 'a', Env.x.fields['a'])
        self.assertReq(a_ref,
                       Edge([Link('x', Edge([Field('a')]))]))
Esempio n. 2
0
    def testLinkListEdgeField(self):
        xs_ref = NamedRef(None, 'xs', Env.xs)
        self.assertReq(xs_ref,
                       Edge([Link('xs', Edge([]))]))

        x_ref = Ref(xs_ref, Env.x)
        self.assertReq(x_ref,
                       Edge([Link('xs', Edge([]))]))

        c_ref = NamedRef(x_ref, 'c', Env.x.fields['c'])
        self.assertReq(c_ref,
                       Edge([Link('xs', Edge([Field('c')]))]))
Esempio n. 3
0
    def testLinkOneEdgeField(self):
        x1_ref = NamedRef(None, 'x1', Env.x1)
        self.assertReq(x1_ref,
                       Edge([Link('x1', Edge([]))]))

        x_ref = Ref(x1_ref, Env.x)
        self.assertReq(x_ref,
                       Edge([Link('x1', Edge([]))]))

        b_ref = NamedRef(x_ref, 'b', Env.x.fields['b'])
        self.assertReq(b_ref,
                       Edge([Link('x1', Edge([Field('b')]))]))
Esempio n. 4
0
 def testAddReq(self):
     self.assertReq(NamedRef(None, 'xs', Env.xs),
                    Edge([Link('xs', Edge([Field('a'), Field('c')]))]),
                    add_req=Edge([Field('a'), Field('c')]))
Esempio n. 5
0
 def testField(self):
     self.assertReq(NamedRef(None, 'f', Env.f),
                    Edge([Field('f')]))
Esempio n. 6
0
 def testEdgeField(self):
     expr = self.check(S.x.a)
     self.assertRef(expr, NamedRef(NamedRef(None, 'x', Env.x),
                                   'a', Env.x.fields['a']))
Esempio n. 7
0
 def testField(self):
     expr = self.check(S.f)
     self.assertRef(expr, NamedRef(None, 'f', Env.f))