8000 TST: Use explicit NaT in test_structure_format · juliantaylor/numpy@0724f58 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0724f58

Browse files
committed
TST: Use explicit NaT in test_structure_format
Using np.nan to fill a datetime64 array with NaT depends on the undefined behavior of a float64 to int64 cast, which may have different behaviors on non-x64 platforms. See numpy#8325. For this reason np.datetime64('NaT') should be used fill or set datetime64 arrays with NaT.
1 parent ee6780f commit 0724f58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpy/core/tests/test_arrayprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_structure_format(self):
141141

142142
# for issue #5692
143143
A = np.zeros(shape=10, dtype=[("A", "M8[s]")])
144-
A[5:].fill(np.nan)
144+
A[5:].fill(np.datetime64('NaT'))
145145
assert_equal(np.array2string(A),
146146
"[('1970-01-01T00:00:00',) ('1970-01-01T00:00:00',) " +
147147
"('1970-01-01T00:00:00',)\n ('1970-01-01T00:00:00',) " +

0 commit comments

Comments
 (0)
0