コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
0
 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)
コード例 #6
0
 def test_end(self):
     """End the audio source"""
     src = AudioSrc(port=3000)
     src.pipeline = MockPipeline()
     src.end()
コード例 #7
0
 def test_pause(self):
     """Pause the audio source"""
     src = AudioSrc(port=3000)
     src.pipeline = MockPipeline()
     src.pause()
コード例 #8
0
 def test_run(self):
     """Run the audio source"""
     src = AudioSrc(port=3000)
     src.pipeline = MockPipeline()
     src.run()
コード例 #9
0
 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)
コード例 #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
コード例 #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
コード例 #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)
コード例 #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)
コード例 #14
0
 def test_blank(self):
     """Test when port is null"""
     tests = ['', None, [], {}]
     for test in tests:
         with pytest.raises(ValueError):
             AudioSrc(port=test)