MCPcopy Create free account
hub / github.com/enthought/comtypes / test

Method test

comtypes/test/test_sapi.py:13–30  ·  view source on GitHub ↗
(self, dynamic=False)

Source from the content-addressed store, hash-verified

11
12class Test(unittest.TestCase):
13 def test(self, dynamic=False):
14 engine = CreateObject("SAPI.SpVoice", dynamic=dynamic)
15 stream = CreateObject("SAPI.SpFileStream", dynamic=dynamic)
16 from comtypes.gen import SpeechLib
17
18 fd, fname = tempfile.mkstemp(suffix=".wav")
19 os.close(fd)
20
21 stream.Open(fname, SpeechLib.SSFMCreateForWrite)
22
23 # engine.AudioStream is a propputref property
24 engine.AudioOutputStream = stream
25 self.assertEqual(engine.AudioOutputStream, stream)
26 engine.speak("Hello, World", 0)
27 stream.Close()
28 filesize = os.stat(fname).st_size
29 self.assertTrue(filesize > 100, "filesize only %d bytes" % filesize)
30 os.unlink(fname)
31
32 def test_dyndisp(self):
33 return self.test(dynamic=True)

Callers 1

test_dyndispMethod · 0.95

Calls 1

CreateObjectFunction · 0.90

Tested by

no test coverage detected