|
11 | 11 | from numcodecs.vlen import VLenArray |
12 | 12 | except ImportError: # pragma: no cover |
13 | 13 | raise nose.SkipTest("vlen-array not available") |
14 | | -from numcodecs.tests.common import (check_config, check_repr, check_encode_decode_array, |
15 | | - check_backwards_compatibility) |
| 14 | +from numcodecs.tests.common import (check_config, check_repr, |
| 15 | + check_encode_decode_array, |
| 16 | + check_backwards_compatibility, |
| 17 | + assert_array_items_equal) |
16 | 18 |
|
17 | 19 |
|
18 | 20 | arrays = [ |
@@ -88,3 +90,14 @@ def test_decode_errors(): |
88 | 90 | codec.decode(enc, out=123) |
89 | 91 | with assert_raises(ValueError): |
90 | 92 | codec.decode(enc, out=np.zeros(10, dtype='i4')) |
| 93 | + |
| 94 | + |
| 95 | +def test_encode_none(): |
| 96 | + a = np.array([[1, 3], None, [4, 7]], dtype=object) |
| 97 | + codec = VLenArray(int) |
| 98 | + enc = codec.encode(a) |
| 99 | + dec = codec.decode(enc) |
| 100 | + expect = np.array([np.array([1, 3]), |
| 101 | + np.array([]), |
| 102 | + np.array([4, 7])], dtype=object) |
| 103 | + assert_array_items_equal(expect, dec) |
0 commit comments