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')]))]))
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')]))]))
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')]))]))
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')]))
def testField(self): self.assertReq(NamedRef(None, 'f', Env.f), Edge([Field('f')]))
def testEdgeField(self): expr = self.check(S.x.a) self.assertRef(expr, NamedRef(NamedRef(None, 'x', Env.x), 'a', Env.x.fields['a']))
def testField(self): expr = self.check(S.f) self.assertRef(expr, NamedRef(None, 'f', Env.f))