8000 Fix npz header incompatibility by charris · Pull Request #5178 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Fix npz header incompatibility #5178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 13, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
TST: Add tests for Python2, Python3 *.npy compatibility.
  • Loading branch information
charris committed Oct 12, 2014
commit 8b1f90a227b5fcf2a481c973e522693758c9f20f
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
* text=auto
tools/win32build/nsis_scripts/*.nsi.in eol=crlf

# Numerical data files
numpy/lib/tests/data/*.npy binary
Binary file added numpy/lib/tests/data/python3.npy
Binary file not shown.
Binary file added numpy/lib/tests/data/win64python2.npy
Binary file not shown.
10 changes: 10 additions & 0 deletions numpy/lib/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,16 @@ def test_compressed_roundtrip():
assert_array_equal(arr, arr1)


def test_python2_python3_interoperability():
if sys.version_info[0] >= 3:
fname = 'win64python2.npy'
else:
fname = 'python3.npy'
path = os.path.join(os.path.dirname(__file__), 'data', fname)
data = np.load(path)
assert_array_equal(data, np.ones(2))


def test_version_2_0():
f = BytesIO()
# requires more than 2 byte for header
Expand Down
0