[Python-3000-checkins] r56162 - python/branches/py3k-struni/Lib/test/test_struct.py

guido.van.rossum python-3000-checkins at python.org
Tue Jul 3 18:28:48 CEST 2007


Author: guido.van.rossum
Date: Tue Jul  3 18:28:47 2007
New Revision: 56162

Modified:
   python/branches/py3k-struni/Lib/test/test_struct.py
Log:
Fix test_struct.  A bunch of array and bytes issues.


Modified: python/branches/py3k-struni/Lib/test/test_struct.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_struct.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_struct.py	Tue Jul  3 18:28:47 2007
@@ -578,8 +578,8 @@
             simple_err(struct.unpack_from, fmt, data, i)
 
 def test_pack_into():
-    test_string = 'Reykjavik rocks, eow!'
-    writable_buf = array.array('c', ' '*100)
+    test_string = b'Reykjavik rocks, eow!'
+    writable_buf = array.array('b', b' '*100)
     fmt = '21s'
     s = struct.Struct(fmt)
 
@@ -594,13 +594,13 @@
     vereq(from_buf, test_string[:10] + test_string)
 
     # Go beyond boundaries.
-    small_buf = array.array('c', ' '*10)
+    small_buf = array.array('b', b' '*10)
     assertRaises(struct.error, s.pack_into, small_buf, 0, test_string)
     assertRaises(struct.error, s.pack_into, small_buf, 2, test_string)
 
 def test_pack_into_fn():
-    test_string = 'Reykjavik rocks, eow!'
-    writable_buf = array.array('c', ' '*100)
+    test_string = b'Reykjavik rocks, eow!'
+    writable_buf = array.array('b', b' '*100)
     fmt = '21s'
     pack_into = lambda *args: struct.pack_into(fmt, *args)
 
@@ -615,7 +615,7 @@
     vereq(from_buf, test_string[:10] + test_string)
 
     # Go beyond boundaries.
-    small_buf = array.array('c', ' '*10)
+    small_buf = array.array('b', b' '*10)
     assertRaises(struct.error, pack_into, small_buf, 0, test_string)
     assertRaises(struct.error, pack_into, small_buf, 2, test_string)
 


More information about the Python-3000-checkins mailing list