From e263c9e530626980f7688cb65823142ac947d4e5 Mon Sep 17 00:00:00 2001 From: Keith Goodman Date: Wed, 29 Jan 2014 13:48:18 -0800 Subject: [PATCH] BUG la.close() crashes; closes #73 --- README.rst | 4 ++-- RELEASE.rst | 1 + la/io.py | 2 +- la/tests/io_test.py | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index aa05c8f..a255720 100644 --- a/README.rst +++ b/README.rst @@ -120,9 +120,9 @@ After you have installed ``la``, run the suite of unit tests:: >>> import la >>> la.test() - Ran 3003 tests in 12.225s + Ran 3005 tests in 12.225s OK - + The ``la`` package contains C extensions that speed up common alignment operations such as adding two unaligned larrys. If the C extensions don't diff --git a/RELEASE.rst b/RELEASE.rst index 557174c..ef7b575 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -47,6 +47,7 @@ la 0.7 - #68 h5py prevents archiving of empty larrys - #69, #70 Unit test failures on Windows - #71 la.stack() Python 3.3 unit test failure +- #73 la.load() crashes due to typo Older versions ============== diff --git a/la/io.py b/la/io.py index 2aff1b6..aa7b6b4 100644 --- a/la/io.py +++ b/la/io.py @@ -509,7 +509,7 @@ def load(file, key): # Load larry group = f[key] x = group['x'][:] - label = _load_label(group, x.ndim) + label = _load_label(f, key) # Close if file is a filename if opened: diff --git a/la/tests/io_test.py b/la/tests/io_test.py index c580293..cd44e2f 100644 --- a/la/tests/io_test.py +++ b/la/tests/io_test.py @@ -192,6 +192,23 @@ def test_io_len(self): io['y'] = y self.assertTrue(len(io) == 2, 'number of keys is wrong') + def test_io_load_1(self): + "io.load_1" + d = larry([1,2,3]) + la.save(self.filename, d, 'd') + a = la.load(self.filename, 'd') + assert_larry_equal(a, d) + la.io.delete(self.filename, 'd') + + def test_io_load_2(self): + "io.load_2" + f = h5py.File(self.filename) + d = larry([1,2,3]) + la.save(f, d, 'd') + a = la.load(f, 'd') + assert_larry_equal(a, d) + la.io.delete(f, 'd') + # nose tests ---------------------------------------------------------------- def datetime_test():