forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_helpers.py
31 lines (25 loc) · 895 Bytes
/
test_helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from helpers import TestSources, PreviewSinks
from exception import RangeError
import pytest
from mock import Mock, patch
class TestTestSourcesVideoPort(object):
def test_blank(self):
tests = ['', None, [], {}]
for test in tests:
with pytest.raises(ValueError):
TestSources(video_port=test)
def test_range(self):
tests = [-100, 1e7, 65536]
for test in tests:
with pytest.raises(RangeError):
TestSources(video_port=test)
def test_invalid(self):
tests = [[1, 2, 3, 4], {1: 2, 2: 3}, '1e10']
for test in tests:
with pytest.raises(TypeError):
TestSources(video_port=test)
def test_normal(self):
tests = [1, 65535, 1000]
for test in tests:
src = TestSources(video_port=test)
assert src.video_port == test