예제 #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'}
         )
예제 #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")'
        }
예제 #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'})
예제 #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'}
         )
예제 #5
0
 def simple3(self):
     return make_mock_conf(
         {
             "name": "foobar",
             "tags": ["foo", "bar"],
             "vocabulary": {"plus": "+ "},
             "shortcuts": {"literal entry": "c-v"},
         }
     )
예제 #6
0
 def simple2(self):
     return make_mock_conf(
         {
             "name": "foobaz",
             "tags": ["foo", "baz", "global"],
             "vocabulary": {"bit ore": "| "},
             "shortcuts": {"kill": "c-backslash"},
         }
     )
예제 #7
0
 def simple1(self):
     return make_mock_conf(
         {
             "name": "barbaz",
             "tags": ["bar", "baz"],
             "vocabulary": {"compare eek": "== "},
             "shortcuts": {"interrupt": "c-c"},
         }
     )
예제 #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'
                                                   })
예제 #9
0
 def simple1(self):
     return make_mock_conf({
         'name': 'barbaz',
         'tags': ['bar', 'baz'],
         'vocabulary': {
             'compare eek': '== '
             },
         'shortcuts': {
             'interrupt': 'c-c'
             }
         })
예제 #10
0
 def simple2(self):
     return make_mock_conf({
         'name': 'foobaz',
         'tags': ['foo', 'baz', 'global'],
         'vocabulary': {
             'bit ore': '| '
         },
         'shortcuts': {
             'kill': 'c-backslash'
         }
     })
예제 #11
0
 def simple2(self):
     return make_mock_conf({
         'name': 'foobaz',
         'tags': ['foo', 'baz', 'global'],
         'vocabulary': {
             'bit ore': '| '
             },
         'shortcuts': {
             'kill': 'c-backslash'
             }
         })
예제 #12
0
 def simple3(self):
     return make_mock_conf({
         'name': 'foobar',
         'tags': ['foo', 'bar'],
         'vocabulary': {
             'plus': '+ '
         },
         'shortcuts': {
             'literal entry': 'c-v'
         }
     })
예제 #13
0
 def simple1(self):
     return make_mock_conf({
         'name': 'barbaz',
         'tags': ['bar', 'baz'],
         'vocabulary': {
             'compare eek': '== '
         },
         'shortcuts': {
             'interrupt': 'c-c'
         }
     })
예제 #14
0
 def simple3(self):
     return make_mock_conf({
         'name': 'foobar',
         'tags': ['foo', 'bar'],
         'vocabulary': {
             'plus': '+ '
             },
         'shortcuts': {
             'literal entry': 'c-v'
             }
         })
예제 #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")'
            }
예제 #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")'}
예제 #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'})
예제 #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'})
예제 #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'})
예제 #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'}
         )