[Python-checkins] python/dist/src/Lib/test pickletester.py,1.32,1.33

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Sat, 01 Feb 2003 23:51:34 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv7771/Lib/test

Modified Files:
	pickletester.py 
Log Message:
long(string, base) now takes time linear in len(string) when base is a
power of 2.  Enabled the tail end of test_long() in pickletester.py
because it no longer takes forever when run from test_pickle.py.


Index: pickletester.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/pickletester.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** pickletester.py	2 Feb 2003 02:57:52 -0000	1.32
--- pickletester.py	2 Feb 2003 07:51:32 -0000	1.33
***************
*** 248,252 ****
      def test_long(self):
          for proto in protocols:
!             # 256 bytes is where LONG4 begins
              for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257:
                  nbase = 1L << nbits
--- 248,252 ----
      def test_long(self):
          for proto in protocols:
!             # 256 bytes is where LONG4 begins.
              for nbits in 1, 8, 8*254, 8*255, 8*256, 8*257:
                  nbase = 1L << nbits
***************
*** 258,275 ****
          # Try a monster.  This is quadratic-time in protos 0 & 1, so don't
          # bother with those.
-         # XXX Damn.  pickle.py is still quadratic-time here, due to
-         # XXX long(string, 16).  cPickle runs this in an eyeblink, but I
-         # XXX gave up waiting for pickle.py to get beyond "loading".  Giving
-         # XXX up for now.
-         return
-         print "building long"
          nbase = long("deadbeeffeedface", 16)
          nbase += nbase << 1000000
          for n in nbase, -nbase:
-             print "dumping"
              p = self.dumps(n, 2)
-             print "loading"
              got = self.loads(p)
-             print "checking"
              self.assertEqual(n, got)
  
--- 258,266 ----