File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -30,3 +30,8 @@ def sct(display):
30
30
@pytest .fixture (scope = 'session' )
31
31
def is_travis ():
32
32
return 'TRAVIS' in environ
33
+
34
+
35
+ @pytest .fixture (scope = 'session' )
36
+ def raw ():
37
+ return open ('tests/monitor-1024x768.raw' , 'rb' ).read ()
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ import pytest
5
+
6
+
7
+ def test_bad_length (sct ):
8
+ sct .width = 1024
9
+ sct .height = 768
10
+ with pytest .raises (ValueError ):
11
+ sct .bgra_to_rgb (bytearray (b'789c626001000000ffff030000060005' ))
12
+
13
+
14
+ def test_good_bytes (sct , raw ):
15
+ sct .width = 1024
16
+ sct .height = 768
17
+ image = sct .bgra_to_rgb (raw )
18
+ assert isinstance (image , bytes )
19
+
20
+
21
+ def test_good_bytearray (sct , raw ):
22
+ sct .width = 1024
23
+ sct .height = 768
24
+ image = sct .bgra_to_rgb (bytearray (raw ))
25
+ assert isinstance (image , bytes )
You can’t perform that action at this time.
0 commit comments