def test_pause(self): """Test pause method""" src = Preview(port=3001) src.pipeline = MockPipeline() src.pause()
def test_end(self): """Test end method""" src = Preview(port=3001) src.pipeline = MockPipeline() src.end()
def test_run(self): """Test play method""" src = Preview(port=3001) src.pipeline = MockPipeline() src.run()
def test_normal(self): """Test when port is valid""" tests = [1, 65535, 1000] for test in tests: src = Preview(port=test) assert src.preview_port == test
def test_invalid(self): """Test when 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): Preview(port=test)
def test_range(self): """Test when port is not in range""" tests = [-100, 1e7, 65536] for test in tests: with pytest.raises(RangeError): Preview(port=test)
def test_blank(self): """Test when port is null""" tests = ['', None, [], {}] for test in tests: with pytest.raises(ValueError): Preview(port=test)