def test_get_path_dotted_no_file(self, mimport_module): mimport_module.return_value.__file__ = 'module/path/__init__.py' paths = PathDict() self.assertEqual( paths.get_path_dotted('test.me'), 'module/path/__init__.py', )
def test_to_dict(self): paths = PathDict() paths.append_parent(self.parent1, 'paths') paths['root'] = ['/tmp', 'elo'] paths.set_path('my', 'root', 'self') del self.child['morf3_parent'] self.assertEqual({ 'morf_child': 'parent1 morf morf child', 'mychild': { 'child_key': 'child1', 'morf2_parent': 'parent2 morf', 'morf_parent': 'parent1 morf'}, 'parent_key': 'parent1', 'paths': { 'my': '/tmp/elo/self', 'root': '/tmp/elo'} }, self.parent1.to_dict())