Skip to content

Commit

Permalink
Ignore autoformatting arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodmillman committed Oct 10, 2023
1 parent e3c19c5 commit e7f6abc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions skimage/draw/tests/test_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ def test_circle_perimeter_aa():
img = np.zeros((17, 17), 'uint8')
rr, cc, val = circle_perimeter_aa(8, 8, 7)
img[rr, cc] = val * 255
# fmt: off
img_ = np.array(
[[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 82, 180, 236, 255, 236, 180, 82, 0, 0, 0, 0, 0],
Expand All @@ -352,6 +353,7 @@ def test_circle_perimeter_aa():
[ 0, 0, 0, 0, 0, 82, 180, 236, 255, 236, 180, 82, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
)
# fmt: on
assert_array_equal(img, img_)


Expand Down
5 changes: 3 additions & 2 deletions skimage/filters/tests/test_fft_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def test_butterworth_4D_channel(chan, dtype):

def test_butterworth_correctness_bw():
small = coins()[180:190, 260:270]
filtered = butterworth(small,
cutoff_frequency_ratio=0.2)
filtered = butterworth(small, cutoff_frequency_ratio=0.2)
# fmt: off
correct = np.array(
[
[ 28.63019362, -17.69023786, 26.95346957, 20.57423019, -15.1933463 , -28.05828136, -35.25135674, -25.70376951, -43.37121955, -16.87688457],
Expand All @@ -179,6 +179,7 @@ def test_butterworth_correctness_bw():
[-50.53430811, 12.14152989, 17.69341877, 9.1858496 , 12.1470914 , 1.45865179, 61.08961357, 29.76775029, -11.04603619, 24.18621404],
]
)
# fmt: on
assert_allclose(filtered, correct)


Expand Down
4 changes: 3 additions & 1 deletion skimage/measure/_marching_cubes_lewiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ def _to_array(args):
# 0
# 3 1 -> 0x
# 2 xx

# fmt: off
EDGETORELATIVEPOSX = np.array([ [0,1],[1,1],[1,0],[0,0], [0,1],[1,1],[1,0],[0,0], [0,0],[1,1],[1,1],[0,0] ], 'int8')
EDGETORELATIVEPOSY = np.array([ [0,0],[0,1],[1,1],[1,0], [0,0],[0,1],[1,1],[1,0], [0,0],[0,0],[1,1],[1,1] ], 'int8')
EDGETORELATIVEPOSZ = np.array([ [0,0],[0,0],[0,0],[0,0], [1,1],[1,1],[1,1],[1,1], [0,1],[0,1],[0,1],[0,1] ], 'int8')

# fmt: on

def _get_mc_luts():
""" Kind of lazy obtaining of the luts.
Expand Down
3 changes: 2 additions & 1 deletion skimage/segmentation/tests/test_watershed.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .._watershed import watershed

eps = 1e-12
# fmt: off
blob = np.array([[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 204, 204, 204, 204, 204, 204, 255, 255, 255, 255, 255],
Expand All @@ -34,7 +35,7 @@
[255, 255, 255, 255, 255, 204, 204, 204, 204, 204, 204, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]])

# fmt: on

def diff(a, b):
if not isinstance(a, np.ndarray):
Expand Down
2 changes: 2 additions & 0 deletions skimage/util/tests/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ def test_compare_images_checkerboard_default():
img1 = np.zeros((2**4, 2**4), dtype=np.uint8)
img2 = np.full(img1.shape, fill_value=255, dtype=np.uint8)
res = compare_images(img1, img2, method='checkerboard')
# fmt: off
exp_row1 = np.array([0., 0., 1., 1., 0., 0., 1., 1., 0., 0., 1., 1., 0., 0., 1., 1.])
exp_row2 = np.array([1., 1., 0., 0., 1., 1., 0., 0., 1., 1., 0., 0., 1., 1., 0., 0.])
# fmt: on
for i in (0, 1, 4, 5, 8, 9, 12, 13):
assert_array_equal(res[i, :], exp_row1)
for i in (2, 3, 6, 7, 10, 11, 14, 15):
Expand Down

0 comments on commit e7f6abc

Please sign in to comment.