diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-03-30 16:03:44 -0400 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-03-30 16:03:44 -0400 |
| commit | d31fabf8cff5dae02e3fc759a4203bd374dddc99 (patch) | |
| tree | 888ec4e6d98154f862a3b9cd17a3394b657bc02e /client/test_mic.py | |
| parent | 4182b5e096e081158dddd4ad5d031af94fcc63de (diff) | |
| download | jasper-client-d31fabf8cff5dae02e3fc759a4203bd374dddc99.tar.gz jasper-client-d31fabf8cff5dae02e3fc759a4203bd374dddc99.zip | |
Initial commit
Diffstat (limited to 'client/test_mic.py')
| -rw-r--r-- | client/test_mic.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/client/test_mic.py b/client/test_mic.py new file mode 100644 index 0000000..b01240f --- /dev/null +++ b/client/test_mic.py @@ -0,0 +1,27 @@ +""" +A drop-in replacement for the Mic class used during unit testing. +Designed to take pre-arranged inputs as an argument and store any +outputs for inspection. Requires a populated profile (profile.yml). +""" + + +class Mic: + + def __init__(self, inputs): + self.inputs = inputs + self.idx = 0 + self.outputs = [] + + def passiveListen(self, PERSONA): + return True, "JASPER" + + def activeListen(self, THRESHOLD=None, LISTEN=True, MUSIC=False): + if not LISTEN: + return self.inputs[self.idx - 1] + + input = self.inputs[self.idx] + self.idx += 1 + return input + + def say(self, phrase, OPTIONS=None): + self.outputs.append(phrase) |
