Skip to content
Browse files

BUG: Fix datetime 1.6 pickle compatibility test for Python 3.

In Python 3 the pickle.loads function expects a bytes argument, so
convert the test strings.
  • Loading branch information...
1 parent dc468d1 commit ddc944eb6ae67de5c0e184505651ca1f50517bbd @charris charris committed May 10, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 numpy/core/tests/test_datetime.py
View
6 numpy/core/tests/test_datetime.py
@@ -537,15 +537,15 @@ def test_pickle(self):
pkl = "cnumpy\ndtype\np0\n(S'M8'\np1\nI0\nI1\ntp2\nRp3\n" + \
"(I4\nS'<'\np4\nNNNI-1\nI-1\nI0\n((dp5\n(S'D'\np6\n" + \
"I7\nI1\nI1\ntp7\ntp8\ntp9\nb."
- assert_equal(pickle.loads(pkl), np.dtype('<M8[7D]'))
+ assert_equal(pickle.loads(asbytes(pkl)), np.dtype('<M8[7D]'))
pkl = "cnumpy\ndtype\np0\n(S'M8'\np1\nI0\nI1\ntp2\nRp3\n" + \
"(I4\nS'<'\np4\nNNNI-1\nI-1\nI0\n((dp5\n(S'W'\np6\n" + \
"I1\nI1\nI1\ntp7\ntp8\ntp9\nb."
- assert_equal(pickle.loads(pkl), np.dtype('<M8[W]'))
+ assert_equal(pickle.loads(asbytes(pkl)), np.dtype('<M8[W]'))
pkl = "cnumpy\ndtype\np0\n(S'M8'\np1\nI0\nI1\ntp2\nRp3\n" + \
"(I4\nS'>'\np4\nNNNI-1\nI-1\nI0\n((dp5\n(S'us'\np6\n" + \
"I1\nI1\nI1\ntp7\ntp8\ntp9\nb."
- assert_equal(pickle.loads(pkl), np.dtype('>M8[us]'))
+ assert_equal(pickle.loads(asbytes(pkl)), np.dtype('>M8[us]'))
def test_dtype_promotion(self):
# datetime <op> datetime computes the metadata gcd

0 comments on commit ddc944e

Please sign in to comment.
Something went wrong with that request. Please try again.