Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite05a632

Browse files
committed
Improve test for correct clipping
1 parent068fa28 commite05a632

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎lib/matplotlib/tests/test_image.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,16 +801,18 @@ def test_imshow_clips_rgb_to_valid_range(dtype):
801801
arr=np.arange(300,dtype=dtype).reshape((10,10,3))
802802
ifdtype.kind!='u':
803803
arr-=10
804+
too_low=arr<0
805+
too_high=arr>255
804806
ifdtype.kind=='f':
805807
arr=arr/255
806808
_,ax=plt.subplots()
807809
out=ax.imshow(arr).get_array()
808-
assertout.min()==0
810+
assert(out[too_low]==0).all()
809811
ifdtype.kind=='f':
810-
assertout.max()==1
812+
assert(out[too_high]==1).all()
811813
assertout.dtype.kind=='f'
812814
else:
813-
assertout.max()==255
815+
assert(out[too_high]==255).all()
814816
assertout.dtype==np.uint8
815817

816818

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp