def test__keywrap__2(self): docs = (tableclass(Document))() pages = (tableclass(Page))() dct = join_.JoinTypeDict() rel = link_.Link((docs,pages), ('pages','doc'), column = 0) self.assertIsInstance(dct.__keywrap__(rel), ref_.Ref) self.assertIs(dct.__keywrap__(rel).obj, rel)
def test__keywrap__1(self): docs = (tableclass(Document))() pages = (tableclass(Page))() dct = join_.JoinTypeDict() rel = junction_.Junction((docs,pages),('pages','doc')) self.assertIsInstance(dct.__keywrap__(rel), ref_.Ref) self.assertIs(dct.__keywrap__(rel).obj, rel)
def test__wrap__2(self): dct = join_.JoinTypeDict() with self.assertRaisesRegex(ValueError, 'invalid join type %s' % repr('asdf')): dct.__wrap__('asdf')
def test__wrap__1(self): dct = join_.JoinTypeDict() self.assertIs(dct.__wrap__(join_.INNER_JOIN), join_.INNER_JOIN) self.assertIs(dct.__wrap__(join_.LEFT_JOIN), join_.LEFT_JOIN) self.assertIs(dct.__wrap__(join_.RIGHT_JOIN), join_.RIGHT_JOIN) self.assertIs(dct.__wrap__(join_.OUTER_JOIN), join_.OUTER_JOIN)
def test__keywrap__3(self): dct = join_.JoinTypeDict() msg = re.escape(r'%s is not an instance of %s' % (repr('asdf'), repr(relation_.Relation))) with self.assertRaisesRegex(TypeError, msg): dct.__keywrap__('asdf')