Esempio n. 1
0
 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'}
         )
Esempio n. 2
0
    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")'
        }
Esempio n. 3
0
 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'})
Esempio n. 4
0
 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'}
         )
Esempio n. 5
0
 def simple3(self):
     return make_mock_conf(
         {
             "name": "foobar",
             "tags": ["foo", "bar"],
             "vocabulary": {"plus": "+ "},
             "shortcuts": {"literal entry": "c-v"},
         }
     )
Esempio n. 6
0
 def simple2(self):
     return make_mock_conf(
         {
             "name": "foobaz",
             "tags": ["foo", "baz", "global"],
             "vocabulary": {"bit ore": "| "},
             "shortcuts": {"kill": "c-backslash"},
         }
     )
Esempio n. 7
0
 def simple1(self):
     return make_mock_conf(
         {
             "name": "barbaz",
             "tags": ["bar", "baz"],
             "vocabulary": {"compare eek": "== "},
             "shortcuts": {"interrupt": "c-c"},
         }
     )
Esempio n. 8
0
 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'
                                                   })
Esempio n. 9
0
 def simple1(self):
     return make_mock_conf({
         'name': 'barbaz',
         'tags': ['bar', 'baz'],
         'vocabulary': {
             'compare eek': '== '
             },
         'shortcuts': {
             'interrupt': 'c-c'
             }
         })
Esempio n. 10
0
 def simple2(self):
     return make_mock_conf({
         'name': 'foobaz',
         'tags': ['foo', 'baz', 'global'],
         'vocabulary': {
             'bit ore': '| '
         },
         'shortcuts': {
             'kill': 'c-backslash'
         }
     })
Esempio n. 11
0
 def simple2(self):
     return make_mock_conf({
         'name': 'foobaz',
         'tags': ['foo', 'baz', 'global'],
         'vocabulary': {
             'bit ore': '| '
             },
         'shortcuts': {
             'kill': 'c-backslash'
             }
         })
Esempio n. 12
0
 def simple3(self):
     return make_mock_conf({
         'name': 'foobar',
         'tags': ['foo', 'bar'],
         'vocabulary': {
             'plus': '+ '
         },
         'shortcuts': {
             'literal entry': 'c-v'
         }
     })
Esempio n. 13
0
 def simple1(self):
     return make_mock_conf({
         'name': 'barbaz',
         'tags': ['bar', 'baz'],
         'vocabulary': {
             'compare eek': '== '
         },
         'shortcuts': {
             'interrupt': 'c-c'
         }
     })
Esempio n. 14
0
 def simple3(self):
     return make_mock_conf({
         'name': 'foobar',
         'tags': ['foo', 'bar'],
         'vocabulary': {
             'plus': '+ '
             },
         'shortcuts': {
             'literal entry': 'c-v'
             }
         })
Esempio n. 15
0
    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")'
            }
Esempio n. 16
0
    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")'}
Esempio n. 17
0
 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'})
Esempio n. 18
0
 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'})
Esempio n. 19
0
 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'})
Esempio n. 20
0
 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'}
         )