@@ -11,6 +11,13 @@ def features():
11
11
window = SlidingWindow (start = 0. , step = 1. , duration = 2. )
12
12
return SlidingWindowFeature (data , window )
13
13
14
+ @pytest .fixture
15
+ def one_feature ():
16
+ return SlidingWindowFeature (
17
+ np .array ([ [[0 , 0 , 0 ]], [[1 , 1 , 1 ]] ]),
18
+ SlidingWindow ()
19
+ )
20
+
14
21
@pytest .fixture
15
22
def segment ():
16
23
return Segment (3.3 , 6.7 )
@@ -47,3 +54,23 @@ def test_crop_fixed_out_of_bounds(features):
47
54
expected = np .array ([[0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 ],
48
55
[10 , 10 , 10 , 10 , 11 , 12 , 13 , 14 , 15 ]]).T
49
56
np .testing .assert_array_equal (expected , actual )
57
+
58
+ def test_repr_png (features ):
59
+ try :
60
+ import matplotlib
61
+ import IPython
62
+ except ModuleNotFoundError :
63
+ pytest .skip ("notebook dependencies not available" )
64
+ expected = b'\x89 PNG'
65
+ actual = features ._repr_png_ ()[:4 ]
66
+ assert expected == actual
67
+
68
+ def test_repr_png_one_feature (one_feature ):
69
+ try :
70
+ import matplotlib
71
+ import IPython
72
+ except ModuleNotFoundError :
73
+ pytest .skip ("notebook dependencies not available" )
74
+ expected = b'\x89 PNG'
75
+ actual = one_feature ._repr_png_ ()[:4 ]
76
+ assert expected == actual
0 commit comments