Skip to content

Commit

Permalink
BUG: Fix datetime 1.6 pickle compatibility test for Python 3.
Browse files Browse the repository at this point in the history
In Python 3 the pickle.loads function expects a bytes argument, so
convert the test strings.
  • Loading branch information
charris committed May 10, 2012
1 parent dc468d1 commit ddc944e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions numpy/core/tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ddc944e

Please sign in to comment.