Skip to content

Commit 9133282

Browse files
committed
Readd old datetime/timedelta tests
This restores the old datetime/timedelta tests in their same position in the parameterized compression tests. Should ensure their fixtures stay the same. Also should make sure we haven't accidentally broken backwards compatibility by including the original tests. The new tests with NaT values are included afterwards. This will make sure that new fixture data is generated for them.
1 parent 537606c commit 9133282

File tree

7 files changed

+28
-0
lines changed

7 files changed

+28
-0
lines changed

numcodecs/tests/test_blosc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
np.random.normal(loc=1000, scale=1, size=(100, 10)),
4444
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
4545
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
46+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
47+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
48+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
49+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
4650
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
4751
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
4852
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

numcodecs/tests/test_bz2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
np.random.normal(loc=1000, scale=1, size=(100, 10)),
3131
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
3232
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
33+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
34+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
35+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
36+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
3337
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
3438
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
3539
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

numcodecs/tests/test_gzip.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
np.random.normal(loc=1000, scale=1, size=(100, 10)),
3333
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
3434
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
35+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
36+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
37+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
38+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
3539
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
3640
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
3741
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

numcodecs/tests/test_lz4.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
np.random.normal(loc=1000, scale=1, size=(100, 10)),
3434
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
3535
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
36+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
37+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
38+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
39+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
3640
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
3741
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
3842
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

numcodecs/tests/test_lzma.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
np.random.normal(loc=1000, scale=1, size=(100, 10)),
3939
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
4040
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
41+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
42+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
43+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
44+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
4145
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
4246
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
4347
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

numcodecs/tests/test_zlib.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
np.random.normal(loc=1000, scale=1, size=(100, 10)),
3333
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
3434
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
35+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
36+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
37+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
38+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
3539
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
3640
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
3741
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

numcodecs/tests/test_zstd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
np.random.normal(loc=1000, scale=1, size=(100, 10)),
3434
np.random.randint(0, 2, size=1000, dtype=bool).reshape(100, 10, order='F'),
3535
np.random.choice([b'a', b'bb', b'ccc'], size=1000).reshape(10, 10, 10),
36+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('M8[ns]'),
37+
np.random.randint(0, 2**60, size=1000, dtype='u8').view('m8[ns]'),
38+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('M8[m]'),
39+
np.random.randint(0, 2**25, size=1000, dtype='u8').view('m8[m]'),
3640
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('M8[ns]'),
3741
(-np.random.randint(-2**30, 2**30, size=1000, dtype='i8')).view('m8[ns]'),
3842
(-np.random.randint(-2**12, 2**13, size=1000, dtype='i8')).view('M8[m]'),

0 commit comments

Comments
 (0)