diff options
| author | Gerrit Holl <gerrit.holl@utoronto.ca> | 2015-01-15 15:33:18 -0500 |
|---|---|---|
| committer | Gerrit Holl <gerrit.holl@utoronto.ca> | 2015-01-15 15:33:18 -0500 |
| commit | 00ee332e9d95362a3d487f784cdc8fc06cf0832c (patch) | |
| tree | 706e19eadc4689bc143458289439bd3314974ca5 /numpy | |
| parent | 4bfcf4801ceedd0563e3648154fc49985729c442 (diff) | |
| download | numpy-00ee332e9d95362a3d487f784cdc8fc06cf0832c.tar.gz | |
TST: Add testcase for the fix to bug #4476.
Add a testcase `test_fillvalue_datetime_timedelta` to class
`TestFillingValues` for the fix to bug #4476. See commit
216fd17 and pull request #5455.
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/ma/tests/test_core.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index a2ecccb40..975b7aceb 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -1489,6 +1489,21 @@ class TestFillingValues(TestCase): control = np.array((0, 0, 0), dtype="int, float, float").astype(ndtype) assert_equal(_check_fill_value(0, ndtype), control) + def test_fillvalue_datetime_timedelta(self): + # Test default fillvalue for datetime64 and timedelta64 types. + # See issue #4476, this would return '?' which would cause errors + # elsewhere + + for timecode in ("as", "fs", "ps", "ns", "us", "ms", "s", "m", + "h", "D", "W", "M", "Y"): + control = numpy.datetime64("NaT", timecode) + test = default_fill_value(numpy.dtype("<M8[" + timecode + "]")) + assert_equal(test, control) + + control = numpy.timedelta64("NaT", timecode) + test = default_fill_value(numpy.dtype("<m8[" + timecode + "]")) + assert_equal(test, control) + def test_extremum_fill_value(self): # Tests extremum fill values for flexible type. a = array([(1, (2, 3)), (4, (5, 6))], |
