Skip to content

Commit 8b1f90a

Browse files
committed
TST: Add tests for Python2, Python3 *.npy compatibility.
1 parent 8f068b7 commit 8b1f90a

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
* text=auto
22
tools/win32build/nsis_scripts/*.nsi.in eol=crlf
3+
4+
# Numerical data files
5+
numpy/lib/tests/data/*.npy binary

numpy/lib/tests/data/python3.npy

96 Bytes
Binary file not shown.

numpy/lib/tests/data/win64python2.npy

96 Bytes
Binary file not shown.

numpy/lib/tests/test_format.py

+10
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,16 @@ def test_compressed_roundtrip():
524524
assert_array_equal(arr, arr1)
525525

526526

527+
def test_python2_python3_interoperability():
528+
if sys.version_info[0] >= 3:
529+
fname = 'win64python2.npy'
530+
else:
531+
fname = 'python3.npy'
532+
path = os.path.join(os.path.dirname(__file__), 'data', fname)
533+
data = np.load(path)
534+
assert_array_equal(data, np.ones(2))
535+
536+
527537
def test_version_2_0():
528538
f = BytesIO()
529539
# requires more than 2 byte for header

0 commit comments

Comments
 (0)