def test_multiple_undef(self, lgc): commands = {'ouch': 'sting', 'pain': 'sting'} lgc.return_value = make_mock_conf({'commands': commands}) self.assertEquals( aenea.configuration.make_grammar_commands('foo', {'sting': '10k bees'}), {'ouch': '10k bees', 'pain': '10k bees'} )
def setUp(self): aenea.vocabulary._vocabulary = {'static': {}, 'dynamic': {}} aenea.vocabulary._disabled_vocabularies = set() aenea.vocabulary._lists = {'static': {}, 'dynamic': {}} aenea.vocabulary._watchers = { 'static': make_mock_dir({}), 'dynamic': make_mock_dir({}) } aenea.vocabulary._enabled_watcher = make_mock_conf({}) aenea.vocabulary._watchers['static'].files['barbaz'] = self.simple1() aenea.vocabulary._watchers['dynamic'].files['foobaz'] = self.simple2() aenea.vocabulary._watchers['dynamic'].files['foobar'] = self.simple3() self.foo_foobar = {'plus': 'Text("+ ")', 'literal entry': 'Key("c-v")'} self.foo_foobaz = { 'bit ore': 'Text("| ")', 'kill': 'Key("c-backslash")' } self.foo = self.foo_foobar.copy() self.foo.update(self.foo_foobaz) self.bar = {'plus': 'Text("+ ")', 'literal entry': 'Key("c-v")'} self.baz = {'bit ore': 'Text("| ")', 'kill': 'Key("c-backslash")'} self.s_foo = {} self.s_bar = self.s_baz = { 'compare eek': 'Text("== ")', 'interrupt': 'Key("c-c")' }
def test_implicit_undefine(self, lgc): commands = {'honey': 'sting'} lgc.return_value = make_mock_conf({'commands': commands}) self.assertEquals( aenea.configuration.make_grammar_commands('foo', {'sting': '10k bees'}), {'honey': '10k bees'})
def test_illegal_command(self, lgc): commands = {'wasp': 'nest'} lgc.return_value = make_mock_conf({'commands': commands}) self.assertRaises( KeyError, aenea.configuration.make_grammar_commands, 'foo', {'sting': '10k bees'} )
def simple3(self): return make_mock_conf( { "name": "foobar", "tags": ["foo", "bar"], "vocabulary": {"plus": "+ "}, "shortcuts": {"literal entry": "c-v"}, } )
def simple2(self): return make_mock_conf( { "name": "foobaz", "tags": ["foo", "baz", "global"], "vocabulary": {"bit ore": "| "}, "shortcuts": {"kill": "c-backslash"}, } )
def simple1(self): return make_mock_conf( { "name": "barbaz", "tags": ["bar", "baz"], "vocabulary": {"compare eek": "== "}, "shortcuts": {"interrupt": "c-c"}, } )
def test_multiple_undef(self, lgc): commands = {'ouch': 'sting', 'pain': 'sting'} lgc.return_value = make_mock_conf({'commands': commands}) self.assertEquals( aenea.configuration.make_grammar_commands('foo', {'sting': '10k bees'}), { 'ouch': '10k bees', 'pain': '10k bees' })
def simple1(self): return make_mock_conf({ 'name': 'barbaz', 'tags': ['bar', 'baz'], 'vocabulary': { 'compare eek': '== ' }, 'shortcuts': { 'interrupt': 'c-c' } })
def simple2(self): return make_mock_conf({ 'name': 'foobaz', 'tags': ['foo', 'baz', 'global'], 'vocabulary': { 'bit ore': '| ' }, 'shortcuts': { 'kill': 'c-backslash' } })
def simple3(self): return make_mock_conf({ 'name': 'foobar', 'tags': ['foo', 'bar'], 'vocabulary': { 'plus': '+ ' }, 'shortcuts': { 'literal entry': 'c-v' } })
def setUp(self): aenea.vocabulary._vocabulary = {'static': {}, 'dynamic': {}} aenea.vocabulary._disabled_vocabularies = set() aenea.vocabulary._lists = {'static': {}, 'dynamic': {}} aenea.vocabulary._watchers = { 'static': make_mock_dir({}), 'dynamic': make_mock_dir({}) } aenea.vocabulary._enabled_watcher = make_mock_conf({}) aenea.vocabulary._watchers['static'].files['barbaz'] = self.simple1() aenea.vocabulary._watchers['dynamic'].files['foobaz'] = self.simple2() aenea.vocabulary._watchers['dynamic'].files['foobar'] = self.simple3() self.foo_foobar = { 'plus': 'Text("+ ")', 'literal entry': 'Key("c-v")' } self.foo_foobaz = { 'bit ore': 'Text("| ")', 'kill': 'Key("c-backslash")' } self.foo = self.foo_foobar.copy() self.foo.update(self.foo_foobaz) self.bar = { 'plus': 'Text("+ ")', 'literal entry': 'Key("c-v")' } self.baz = { 'bit ore': 'Text("| ")', 'kill': 'Key("c-backslash")' } self.s_foo = {} self.s_bar = self.s_baz = { 'compare eek': 'Text("== ")', 'interrupt': 'Key("c-c")' }
def setUp(self): aenea.vocabulary._vocabulary = {"static": {}, "dynamic": {}} aenea.vocabulary._disabled_vocabularies = set() aenea.vocabulary._lists = {"static": {}, "dynamic": {}} aenea.vocabulary._watchers = {"static": make_mock_dir({}), "dynamic": make_mock_dir({})} aenea.vocabulary._enabled_watcher = make_mock_conf({}) aenea.vocabulary._watchers["static"].files["barbaz"] = self.simple1() aenea.vocabulary._watchers["dynamic"].files["foobaz"] = self.simple2() aenea.vocabulary._watchers["dynamic"].files["foobar"] = self.simple3() self.foo_foobar = {"plus": 'Text("+ ")', "literal entry": 'Key("c-v")'} self.foo_foobaz = {"bit ore": 'Text("| ")', "kill": 'Key("c-backslash")'} self.foo = self.foo_foobar.copy() self.foo.update(self.foo_foobaz) self.bar = {"plus": 'Text("+ ")', "literal entry": 'Key("c-v")'} self.baz = {"bit ore": 'Text("| ")', "kill": 'Key("c-backslash")'} self.s_foo = {} self.s_bar = self.s_baz = {"compare eek": 'Text("== ")', "interrupt": 'Key("c-c")'}
def test_simple(self, lgc): lgc.return_value = make_mock_conf({}) self.assertEquals( aenea.configuration.make_grammar_commands('foo', {'sting': '10k bees'}), {'sting': '10k bees'})
def test_illegal_command(self, lgc): commands = {'wasp': 'nest'} lgc.return_value = make_mock_conf({'commands': commands}) self.assertRaises(KeyError, aenea.configuration.make_grammar_commands, 'foo', {'sting': '10k bees'})
def test_simple(self, lgc): lgc.return_value = make_mock_conf({}) self.assertEquals( aenea.configuration.make_grammar_commands('foo', {'sting': '10k bees'}), {'sting': '10k bees'} )