def test_p5(self) : x = self.pack.p5([]) self.assertEqual(x, [], "msg") # type r1 is record( # a number, # b integer, # c varchar2(200), # d date); x1 = test_pypub1_r1() x1.a = decimal.Decimal("12") x1.b = -15 x1.c = "asgfdhgafdhagfdhgafdha" x1.d = datetime.datetime(2001,1,3) x2 = test_pypub1_r1() x2.a = decimal.Decimal("121221.656") x2.b = -15 x2.c = "ztruztruzttuztrutrutr" x2.d = datetime.datetime(2002,1,3) res = self.pack.p5([x1,x2]) self.assertEqual(res[0].a,x2.a,"aua") self.assertRaises(Exception, lambda v : self.pack.p5([v]),None)
def test_p5(self): x = self.pack.p5([]) self.assertEqual(x, [], "msg") # type r1 is record( # a number, # b integer, # c varchar2(200), # d date); x1 = test_pypub1_r1() x1.a = decimal.Decimal("12") x1.b = -15 x1.c = "asgfdhgafdhagfdhgafdha" x1.d = datetime.datetime(2001, 1, 3) x2 = test_pypub1_r1() x2.a = decimal.Decimal("121221.656") x2.b = -15 x2.c = "ztruztruzttuztrutrutr" x2.d = datetime.datetime(2002, 1, 3) res = self.pack.p5([x1, x2]) self.assertEqual(res[0].a, x2.a, "aua") self.assertRaises(Exception, lambda v: self.pack.p5([v]), None)
def test_tabv(self): l = {} for i in range(30): x1 = test_pypub1_r1() x1.a = decimal.Decimal(repr(12 * i)) x1.b = i * 30 + 5 x1.c = "asgfdhgafdhagfdhgafdha" x1.d = datetime.datetime(2001, int(i / 3) + 1, int(i / 2) + 1) l["a" + repr(i * 8234)] = x1 res = self.pack.p_tabv(l) self.assertTrue(l == res)
def test_tabv(self) : l = {} for i in range(30) : x1 = test_pypub1_r1() x1.a = decimal.Decimal(repr(12*i)) x1.b = i*30+5 x1.c = "asgfdhgafdhagfdhgafdha" x1.d = datetime.datetime(2001,int(i/3)+1,int(i/2)+1) l["a" + repr(i*8234)] = x1 res = self.pack.p_tabv(l) self.assertTrue(l==res)
def test_p5b(self): a = [] for i in range(10000): x1 = test_pypub1_r1() x1.a = decimal.Decimal("12") * decimal.Decimal("121.121221") x1.b = -765865 x1.c = u"asgfdhgafdhagfdhgafdhafdsgfdsgfdsgdsgfdsgfdsgfdsgfdsgfdsgfdsgfdsgfd" x1.d = datetime.datetime(2001, 1, 3) + datetime.timedelta(i) a.append(x1) res = self.pack.p5(a) res = self.pack.p5(res) self.assertTrue(a == res, 'aua')
def test_p5b(self) : a=[] for i in range(10000) : x1 = test_pypub1_r1() x1.a = decimal.Decimal("12") * decimal.Decimal("121.121221") x1.b = -765865 x1.c = u"asgfdhgafdhagfdhgafdhafdsgfdsgfdsgdsgfdsgfdsgfdsgfdsgfdsgfdsgfdsgfd" x1.d = datetime.datetime(2001,1,3) +datetime.timedelta(i) a.append(x1) res = self.pack.p5(a) res = self.pack.p5(res) self.assertTrue(a == res, 'aua')
def test_tabv5(self): l = {} l[None] = test_pypub1_r1() func = lambda x: self.pack.p_tabv(x) self.assertRaises(PackException, func, l)
def test_tabv3(self): l = {} l["nix"] = test_pypub1_r1() res = self.pack.p_tabv(l) self.assertTrue(l == res)
def test_tabi3(self): l = {} l[-123] = test_pypub1_r1() res = self.pack.p_tabi(l) self.assertTrue(l == res)
def test_tabv5(self) : l = {} l[None] = test_pypub1_r1() func = lambda x : self.pack.p_tabv(x) self.assertRaises(PackException, func,l)
def test_tabv3(self) : l = {} l["nix"] = test_pypub1_r1() res = self.pack.p_tabv(l) self.assertTrue(l==res)
def test_tabi3(self) : l = {} l[-123] = test_pypub1_r1() res = self.pack.p_tabi(l) self.assertTrue(l==res)