[Python-checkins] CVS: python/dist/src/Lib/test test_audioop.py,1.9,1.10 test_augassign.py,1.3,1.4 test_b1.py,1.39,1.40 test_binascii.py,1.8,1.9 test_binop.py,1.3,1.4 test_compare.py,1.5,1.6 test_long.py,1.12,1.13 test_operator.py,1.6,1.7 test_pty.py,1.12,1.13 test_strftime.py,1.25,1.26

Guido van Rossum gvanrossum@users.sourceforge.net
2001年9月04日 12:14:16 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv30102/test
Modified Files:
	test_audioop.py test_augassign.py test_b1.py test_binascii.py 
	test_binop.py test_compare.py test_long.py test_operator.py 
	test_pty.py test_strftime.py 
Log Message:
The first batch of changes recommended by the fixdiv tool. These are
mostly changes of / operators into //. Once or twice I did more or
less than recommended.
Index: test_audioop.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_audioop.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_audioop.py	2001年01月17日 21:51:35	1.9
--- test_audioop.py	2001年09月04日 19:14:14	1.10
***************
*** 117,122 ****
 for d1 in data:
 for d2 in data:
! got = len(d1)/3
! wtd = len(d2)/3
 if len(audioop.lin2lin(d1, got, wtd)) != len(d2):
 return 0
--- 117,122 ----
 for d1 in data:
 for d2 in data:
! got = len(d1)//3
! wtd = len(d2)//3
 if len(audioop.lin2lin(d1, got, wtd)) != len(d2):
 return 0
Index: test_augassign.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_augassign.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_augassign.py	2001年08月29日 17:50:22	1.3
--- test_augassign.py	2001年09月04日 19:14:14	1.4
***************
*** 6,10 ****
 x **= 2
 x -= 8
! x /= 2
 x //= 1
 x %= 12
--- 6,10 ----
 x **= 2
 x -= 8
! x //= 2
 x //= 1
 x %= 12
***************
*** 20,25 ****
 x[0] **= 2
 x[0] -= 8
- x[0] /= 2
 x[0] //= 2
 x[0] %= 12
 x[0] &= 2
--- 20,25 ----
 x[0] **= 2
 x[0] -= 8
 x[0] //= 2
+ x[0] //= 2
 x[0] %= 12
 x[0] &= 2
***************
*** 34,38 ****
 x[0] **= 2
 x[0] -= 8
! x[0] /= 2
 x[0] //= 1
 x[0] %= 12
--- 34,38 ----
 x[0] **= 2
 x[0] -= 8
! x[0] //= 2
 x[0] //= 1
 x[0] %= 12
Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** test_b1.py	2001年08月17日 22:08:34	1.39
--- test_b1.py	2001年09月04日 19:14:14	1.40
***************
*** 414,418 ****
 # Failed in all Linux builds.
 x = -1-sys.maxint
! if x >> 1 != x/2:
 raise TestFailed("x >> 1 != x/2 when x == -1-sys.maxint")
 
--- 414,418 ----
 # Failed in all Linux builds.
 x = -1-sys.maxint
! if x >> 1 != x//2:
 raise TestFailed("x >> 1 != x/2 when x == -1-sys.maxint")
 
Index: test_binascii.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_binascii.py	2001年01月17日 19:11:13	1.8
--- test_binascii.py	2001年09月04日 19:14:14	1.9
***************
*** 55,62 ****
 def addnoise(line):
 noise = fillers
! ratio = len(line) / len(noise)
 res = ""
 while line and noise:
! if len(line) / len(noise) > ratio:
 c, line = line[0], line[1:]
 else:
--- 55,62 ----
 def addnoise(line):
 noise = fillers
! ratio = len(line) // len(noise)
 res = ""
 while line and noise:
! if len(line) // len(noise) > ratio:
 c, line = line[0], line[1:]
 else:
Index: test_binop.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binop.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_binop.py	2001年08月24日 18:52:50	1.3
--- test_binop.py	2001年09月04日 19:14:14	1.4
***************
*** 43,48 ****
 raise ZeroDivisionError, "zero denominator"
 g = gcd(den, num)
! self.__num = long(num/g)
! self.__den = long(den/g)
 
 def _get_num(self):
--- 43,48 ----
 raise ZeroDivisionError, "zero denominator"
 g = gcd(den, num)
! self.__num = long(num//g)
! self.__den = long(den//g)
 
 def _get_num(self):
Index: test_compare.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compare.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_compare.py	2001年08月16日 16:56:16	1.5
--- test_compare.py	2001年09月04日 19:14:14	1.6
***************
*** 48,52 ****
 L = []
 for i in range(10):
! L.insert(len(L)/2, Empty())
 for a in L:
 for b in L:
--- 48,52 ----
 L = []
 for i in range(10):
! L.insert(len(L)//2, Empty())
 for a in L:
 for b in L:
Index: test_long.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_long.py	2001年09月04日 06:37:28	1.12
--- test_long.py	2001年09月04日 19:14:14	1.13
***************
*** 77,81 ****
 def test_division_2(x, y):
 q, r = divmod(x, y)
! q2, r2 = x/y, x%y
 pab, pba = x*y, y*x
 check(pab == pba, "multiplication does not commute for", x, y)
--- 77,81 ----
 def test_division_2(x, y):
 q, r = divmod(x, y)
! q2, r2 = x//y, x%y
 pab, pba = x*y, y*x
 check(pab == pba, "multiplication does not commute for", x, y)
***************
*** 118,122 ****
 p2 = 2L ** n
 check(x << n >> n == x, "x << n >> n != x for", x, n)
! check(x / p2 == x >> n, "x / p2 != x >> n for x n p2", x, n, p2)
 check(x * p2 == x << n, "x * p2 != x << n for x n p2", x, n, p2)
 check(x & -p2 == x >> n << n == x & ~(p2 - 1),
--- 118,122 ----
 p2 = 2L ** n
 check(x << n >> n == x, "x << n >> n != x for", x, n)
! check(x // p2 == x >> n, "x // p2 != x >> n for x n p2", x, n, p2)
 check(x * p2 == x << n, "x * p2 != x << n for x n p2", x, n, p2)
 check(x & -p2 == x >> n << n == x & ~(p2 - 1),
***************
*** 162,166 ****
 y = getran(leny)
 test_bitop_identities_2(x, y)
! test_bitop_identities_3(x, y, getran((lenx + leny)/2))
 
 # ------------------------------------------------- hex oct repr str atol
--- 162,166 ----
 y = getran(leny)
 test_bitop_identities_2(x, y)
! test_bitop_identities_3(x, y, getran((lenx + leny)//2))
 
 # ------------------------------------------------- hex oct repr str atol
***************
*** 297,302 ****
 
 if y:
! expected = longx / longy
! got = x / y
 checkit(x, '/', y)
 
--- 297,302 ----
 
 if y:
! expected = longx // longy
! got = x // y
 checkit(x, '/', y)
 
Index: test_operator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operator.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_operator.py	2001年08月11日 03:21:35	1.6
--- test_operator.py	2001年09月04日 19:14:14	1.7
***************
*** 83,87 ****
 
 def test_div(self):
! self.failUnless(operator.div(5, 2) == 2)
 
 def test_floordiv(self):
--- 83,87 ----
 
 def test_div(self):
! self.failUnless(operator.floordiv(5, 2) == 2)
 
 def test_floordiv(self):
Index: test_pty.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_pty.py	2001年03月29日 04:36:09	1.12
--- test_pty.py	2001年09月04日 19:14:14	1.13
***************
*** 87,91 ****
 debug("Waiting for child (%d) to finish."%pid)
 (pid, status) = os.waitpid(pid, 0)
! res = status / 256
 debug("Child (%d) exited with status %d (%d)."%(pid, res, status))
 if res == 1:
--- 87,91 ----
 debug("Waiting for child (%d) to finish."%pid)
 (pid, status) = os.waitpid(pid, 0)
! res = status >> 8
 debug("Child (%d) exited with status %d (%d)."%(pid, res, status))
 if res == 1:
Index: test_strftime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** test_strftime.py	2001年03月23日 20:24:07	1.25
--- test_strftime.py	2001年09月04日 19:14:14	1.26
***************
*** 65,72 ****
 ('%p', ampm, 'AM or PM as appropriate'),
 ('%S', '%02d' % now[5], 'seconds of current time (00-60)'),
! ('%U', '%02d' % ((now[7] + jan1[6])/7),
 'week number of the year (Sun 1st)'),
 ('%w', '0?%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'),
! ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)/7),
 'week number of the year (Mon 1st)'),
 # %x see below
--- 65,72 ----
 ('%p', ampm, 'AM or PM as appropriate'),
 ('%S', '%02d' % now[5], 'seconds of current time (00-60)'),
! ('%U', '%02d' % ((now[7] + jan1[6])//7),
 'week number of the year (Sun 1st)'),
 ('%w', '0?%d' % ((1+now[6]) % 7), 'weekday as a number (Sun 1st)'),
! ('%W', '%02d' % ((now[7] + (jan1[6] - 1)%7)//7),
 'week number of the year (Mon 1st)'),
 # %x see below

AltStyle によって変換されたページ (->オリジナル) /