Beispiel #1
0
 def as_names(some_map):
     """
     Returns an abstract-to-concrete map as name
     
     @param some_map: dict(str,str) dict(tuple(str,str),tuple(str,str)) or dict(object, object)
     @rtype: iter(tuple(str,str))
     """
     if len(some_map):
         key = some_map.iterkeys().next()
         if isinstance(key, basestring):
             return some_map.iteritems()
         elif isinstance(key, TupleType) and isinstance(key[0], basestring):
             return ((ConfigTools.pair_to_fqn(a), [ConfigTools.pair_to_fqn(cs)])
                     for (a, (cs, _args)) in some_map.iteritems()
                     )
         else:
             return ((ConfigTools.to_fqn(a), map(ConfigTools.to_fqn, cs))
                     for (a, cs) in some_map.iteritems())
     else:
         return ()
 def test_to_fqn(self):
     self.assertEquals("test.unit_tests.commons.testdata.config_tools_testdata.AbstractAutoConfigurable", 
                       ConfigTools.to_fqn(AbstractAutoConfigurable))