def test_invalid(self):
     """Test when wave is not a valid integral value"""
     tests = [[1, 2, 3, 4], {1: 2, 2: 3}, ]
     port = 4000
     for test in tests:
         with pytest.raises(TypeError):
             AudioSrc(port=port, wave=test)
 def test_range(self):
     """Test when frequency is not in range (negative)"""
     tests = [-100, -1]
     port = 4000
     for test in tests:
         with pytest.raises(RangeError):
             AudioSrc(port=port, freq=test)
 def test_range(self):
     """Test when wave is not in range"""
     tests = [-100, -1, 13, 1e2, '1e10']
     port = 4000
     for test in tests:
         with pytest.raises(RangeError):
             AudioSrc(port=port, wave=test)
 def test_invalid(self):
     """Test when frequency is not a valid integral value"""
     tests = [[1, 2, 3, 4], {1: 2, 2: 3}, '1e10']
     port = 4000
     for test in tests:
         with pytest.raises(TypeError):
             AudioSrc(port=port, freq=test)
 def test_blank(self):
     """Test when frequency is null"""
     tests = ['', None, [], {}, 0]
     port = 4000
     for test in tests:
         with pytest.raises(ValueError):
             AudioSrc(port=port, freq=test)
 def test_end(self):
     """End the audio source"""
     src = AudioSrc(port=3000)
     src.pipeline = MockPipeline()
     src.end()
 def test_pause(self):
     """Pause the audio source"""
     src = AudioSrc(port=3000)
     src.pipeline = MockPipeline()
     src.pause()
 def test_run(self):
     """Run the audio source"""
     src = AudioSrc(port=3000)
     src.pipeline = MockPipeline()
     src.run()
 def test_normal(self):
     """Test when wave is valid"""
     tests = [0, 10, 12]
     for test in tests:
         src = AudioSrc(port=4000, wave=test)
         assert src.wave == str(test)
Exemplo n.º 10
0
 def test_normal(self):
     """Test when frequency is valid"""
     tests = [1, 65535, 1000]
     for test in tests:
         src = AudioSrc(port=4000, freq=test)
         assert src.freq == test
Exemplo n.º 11
0
 def test_normal(self):
     """Test when port is valid"""
     tests = [1, 65535, 1000]
     for test in tests:
         src = AudioSrc(port=test)
         assert src.port == test
Exemplo n.º 12
0
 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):
             AudioSrc(port=test)
Exemplo n.º 13
0
 def test_range(self):
     """Test when port is not in range"""
     tests = [-100, 1e7, 65536]
     for test in tests:
         with pytest.raises(RangeError):
             AudioSrc(port=test)
Exemplo n.º 14
0
 def test_blank(self):
     """Test when port is null"""
     tests = ['', None, [], {}]
     for test in tests:
         with pytest.raises(ValueError):
             AudioSrc(port=test)