Ejemplo n.º 1
0
 def test_isDefined(self):
     self.assertTrue(Utilities.isDefined({'a': {'b': {'c': 'd'}}}, '/a'))
     self.assertTrue(Utilities.isDefined({'a': {'b': {'c': 'd'}}}, '/a/b'))
     self.assertTrue(Utilities.isDefined({'a': {
         'b': {
             'c': 'd'
         }
     }}, '/a/b/c'))
     self.assertFalse(
         Utilities.isDefined({'a': {
             'b': {
                 'c': 'd'
             }
         }}, '/a/b/c/d'))
     self.assertFalse(Utilities.isDefined({'a': {
         'b': {
             'c': 'd'
         }
     }}, 'a/z/c'))
Ejemplo n.º 2
0
def prepareGroups(parameters):
    groups = {}

    for keyword, value in parameters['language'].iteritems():
        group, module = tuple(value['package'].split(':'))
        if not Utilities.isDefined(groups, '/' + group + '/' + module):
            dpath.util.new(groups, '/' + group + '/' + module, [])

        groups[group][module].append(keyword)

    return groups