8000 TST: Fixup tests to make windows/32bit systems and linter happy · numpy/numpy@ff552fc · GitHub
[go: up one dir, main page]

Skip to content

Commit ff552fc

Browse files
committed
TST: Fixup tests to make windows/32bit systems and linter happy
1 parent aa044d4 commit ff552fc

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

numpy/core/tests/test_arrayprint.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ def test_structure_format(self):
301301
)
302302

303303
# See #8160
304-
struct_int = np.array([([1, -1],), ([123, 1],)], dtype=[('B', 'i4', 2)])
304+
struct_int = np.array([([1, -1],), ([123, 1],)],
305+
dtype=[('B', 'i4', 2)])
305306
assert_equal(np.array2string(struct_int),
306307
"[([ 1, -1],) ([123, 1],)]")
307308
struct_2dint = np.array([([[0, 1], [2, 3]],), ([[12, 0], [0, 0]],)],
@@ -317,7 +318,8 @@ def test_structure_format(self):
317318
def test_unstructured_void_repr(self):
318319
a = np.array([27, 91, 50, 75, 7, 65, 10, 8,
319320
27, 91, 51, 49,109, 82,101,100], dtype='u1').view('V8')
320-
assert_equal(repr(a[0]), r"np.void(b'\x1B\x5B\x32\x4B\x07\x41\x0A\x08')")
321+
assert_equal(repr(a[0]),
322+
r"np.void(b'\x1B\x5B\x32\x4B\x07\x41\x0A\x08')")
321323
assert_equal(str(a[0]), r"b'\x1B\x5B\x32\x4B\x07\x41\x0A\x08'")
322324
assert_equal(repr(a),
323325
r"array([b'\x1B\x5B\x32\x4B\x07\x41\x0A\x08'," "\n"

numpy/core/tests/test_defchararray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,11 @@ def test_mod(self):
633633

634634
A = np.array([['%.3f', '%d'], ['%s', '%r']]).view(np.chararray)
635635
A1 = np.array([['1.000', '1'],
636-
['1', 'np.int64(1)']]).view(np.chararray)
636+
['1', repr(np.array(1)[()])]]).view(np.chararray)
637637
assert_array_equal(A1, (A % 1))
638638

639639
A2 = np.array([['1.000', '2'],
640-
['3', 'np.int64(4)']]).view(np.chararray)
640+
['3', repr(np.array(4)[()])]]).view(np.chararray)
641641
assert_array_equal(A2, (A % [[1, 2], [3, 4]]))
642642

643643
def test_rmod(self):

numpy/core/tests/test_records.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def test_0d_recarray_repr(self):
132132

133133
record = arr_0d[()]
134134
assert_equal(repr(record),
135-
"np.record((1, 2., '2003'), dtype=[('f0', '<i4'), ('f1', '<f8'), ('f2', '<M8[Y]')])")
135+
"np.record((1, 2., '2003'), "
136+
"dtype=[('f0', '<i4'), ('f1', '<f8'), ('f2', '<M8[Y]')])")
136137
# 1.13 converted to python scalars before the repr
137138
try:
138139
np.set_printoptions(legacy='1.13')

numpy/ma/tests/test_core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,23 +535,23 @@ def test_str_repr(self):
535535
a[1,1] = np.ma.masked
536536
assert_equal(
537537
repr(a),
538-
textwrap.dedent('''\
538+
textwrap.dedent(f'''\
539539
masked_array(
540540
data=[[1, 2, 3],
541541
[4, --, 6]],
542542
mask=[[False, False, False],
543543
[False, True, False]],
544-
fill_value=np.int64(999999),
544+
fill_value={np.array(999999)[()]!r},
545545
dtype=int8)''')
546546
)
547547

548548
# but not it they're a row vector
549549
assert_equal(
550550
repr(a[:1]),
551-
textwrap.dedent('''\
551+
textwrap.dedent(f'''\
552552
masked_array(data=[[1, 2, 3]],
553553
mask=[[False, False, False]],
554-
fill_value=np.int64(999999),
554+
fill_value={np.array(999999)[()]!r},
555555
dtype=int8)''')
556556
)
557557

0 commit comments

Comments
 (0)
0