def test_normal(self):
     """Test when pattern is valid"""
     tests = [1, 0, 19, 10]
     port = 1000
     for test in tests:
         src = VideoSrc(port=port, pattern=test)
         assert src.pattern == str(test)
 def test_invalid(self):
     """Test when pattern is not a valid integer"""
     tests = [[1, 2, 3, 4], {1: 2, 2: 3}]
     port = 1000
     for test in tests:
         with pytest.raises(TypeError):
             VideoSrc(port=port, pattern=test)
 def test_non_positive(self):
     """Test when heightis non-positive"""
     tests = ['-1.111', -1.111, 0, -1e10]
     port = 1000
     for test in tests:
         with pytest.raises(ValueError):
             VideoSrc(port=port, height=test)
 def test_normal(self):
     """Test when height is valid"""
     tests = [1e6, 300, '200']
     port = 1000
     for test in tests:
         src = VideoSrc(port=port, height=test)
         assert src.height == test
 def test_blank(self):
     """Test when the height is a null"""
     tests = ['', None, [], {}]
     port = 1000
     for test in tests:
         with pytest.raises(ValueError):
             VideoSrc(port=port, height=test)
 def test_invalid(self):
     """Test when the width is not a valid float value"""
     tests = [[1, 2, 3], {1: 2, 2: 3}, (1, 2)]
     port = 1000
     for test in tests:
         with pytest.raises(TypeError):
             VideoSrc(port=port, width=test)
 def test_normal(self):
     """Test when the width is valid"""
     tests = [1e6, 300, '200']
     port = 1000
     for test in tests:
         src = VideoSrc(port=port, width=test)
         assert src.width == test
 def test_range(self):
     """Test when pattern is not in range"""
     tests = [-100, 1e7, 65536, -1, 20]
     port = 1000
     for test in tests:
         with pytest.raises(RangeError):
             VideoSrc(port=port, pattern=test)
 def test_normal(self):
     """Test when clockoverlay is valid"""
     tests = [True, False]
     port = 1000
     for test in tests:
         src = VideoSrc(port=port, clockoverlay=test)
         assert src.clockoverlay == test
 def test_fail(self):
     """Test when clockoverlay is not boolean/valid"""
     tests = ['', 1234, 'hi', [1, 2], {1: 2}, None, 0, []]
     port = 1000
     for test in tests:
         with pytest.raises(ValueError):
             VideoSrc(port=port, clockoverlay=test)
 def test_pause(self):
     """Test pause method"""
     src = VideoSrc(port=3000)
     src.pipeline = MockPipeline()
     src.pause()
 def test_normal(self):
     """Test when port is a valid value"""
     tests = [1, 65535, 1000]
     for test in tests:
         src = VideoSrc(port=test)
         assert src.port == test
 def test_invalid(self):
     """Test when the port is not a valid integral value"""
     tests = [[1, 2, 3, 4], {1: 2, 2: 3}, '1e10']
     for test in tests:
         with pytest.raises(TypeError):
             VideoSrc(port=test)
 def test_range(self):
     """Test when the port is not in range"""
     tests = [-100, 1e7, 65536]
     for test in tests:
         with pytest.raises(RangeError):
             VideoSrc(port=test)
 def test_end(self):
     """Test end method"""
     src = VideoSrc(port=3000)
     src.pipeline = MockPipeline()
     src.end()
 def test_run(self):
     """Test run method"""
     src = VideoSrc(port=3000)
     src.pipeline = MockPipeline()
     src.run()
 def test_blank(self):
     """Test when the port is null"""
     tests = ['', None, [], {}]
     for test in tests:
         with pytest.raises(ValueError):
             VideoSrc(port=test)