def test_name_based(self): cls = self.global_ns.class_(name='class_for_nested_enums_t') cls_demangled_name = cls.name self.failUnless(cls.cache.demangled_name == cls_demangled_name) cls_full_name = declarations.full_name(cls) self.failUnless(cls.cache.full_name == cls_full_name) cls_declaration_path = declarations.declaration_path(cls) self.failUnless(cls.cache.declaration_path == cls_declaration_path) enum = cls.enum('ENestedPublic') enum_full_name = declarations.full_name(enum) self.failUnless(enum.cache.full_name == enum_full_name) enum_declaration_path = declarations.declaration_path(enum) self.failUnless(enum.cache.declaration_path == enum_declaration_path) #now we change class name, all internal decls cache should be cleared cls.name = "new_name" self.failUnless(not cls.cache.full_name) self.failUnless(not cls.cache.demangled_name) self.failUnless(not cls.cache.declaration_path) self.failUnless(not enum.cache.full_name) self.failUnless(not enum.cache.demangled_name) self.failUnless(not enum.cache.declaration_path)
def test_name_based( self ): cls = self.global_ns.class_( name='class_for_nested_enums_t' ) cls_demangled_name = cls.name self.failUnless( cls.cache.demangled_name == cls_demangled_name ) cls_full_name = declarations.full_name( cls ) self.failUnless( cls.cache.full_name == cls_full_name ) cls_declaration_path = declarations.declaration_path( cls ) self.failUnless( cls.cache.declaration_path == cls_declaration_path ) enum = cls.enum( 'ENestedPublic' ) enum_full_name = declarations.full_name( enum ) self.failUnless( enum.cache.full_name == enum_full_name ) enum_declaration_path = declarations.declaration_path( enum ) self.failUnless( enum.cache.declaration_path == enum_declaration_path ) #now we change class name, all internal decls cache should be cleared cls.name = "new_name" self.failUnless( not cls.cache.full_name ) self.failUnless( not cls.cache.demangled_name ) self.failUnless( not cls.cache.declaration_path ) self.failUnless( not enum.cache.full_name ) self.failUnless( not enum.cache.demangled_name ) self.failUnless( not enum.cache.declaration_path )
def test_name_based(self): cls = self.global_ns.class_(name='class_for_nested_enums_t') if "CastXML" in utils.xml_generator: self.assertRaises(Exception, lambda: cls.cache.demangled_name) elif "GCCXML" in utils.xml_generator: self.failUnless(cls.cache.demangled_name == cls.name) cls_full_name = declarations.full_name(cls) self.failUnless(cls.cache.full_name == cls_full_name) cls_declaration_path = declarations.declaration_path(cls) self.failUnless(cls.cache.declaration_path == cls_declaration_path) enum = cls.enum('ENestedPublic') enum_full_name = declarations.full_name(enum) self.failUnless(enum.cache.full_name == enum_full_name) enum_declaration_path = declarations.declaration_path(enum) self.failUnless(enum.cache.declaration_path == enum_declaration_path) # now we change class name, all internal decls cache should be cleared cls.name = "new_name" self.failUnless(not cls.cache.full_name) if "GCCXML" in utils.xml_generator: self.failUnless(not cls.cache.demangled_name) self.failUnless(not cls.cache.declaration_path) self.failUnless(not enum.cache.full_name) if "GCCXML" in utils.xml_generator: self.failUnless(not enum.cache.demangled_name) self.failUnless(not enum.cache.declaration_path)
def test_name_based(self): cls = self.global_ns.class_(name='class_for_nested_enums_t') if "CastXML" in utils.xml_generator: self.assertRaises(Exception, lambda: cls.cache.demangled_name) elif "GCCXML" in utils.xml_generator: self.assertTrue(cls.cache.demangled_name == cls.name) cls_full_name = declarations.full_name(cls) self.assertTrue(cls.cache.full_name == cls_full_name) cls_declaration_path = declarations.declaration_path(cls) self.assertTrue(cls.cache.declaration_path == cls_declaration_path) enum = cls.enum('ENestedPublic') enum_full_name = declarations.full_name(enum) self.assertTrue(enum.cache.full_name == enum_full_name) enum_declaration_path = declarations.declaration_path(enum) self.assertTrue(enum.cache.declaration_path == enum_declaration_path) # now we change class name, all internal decls cache should be cleared cls.name = "new_name" self.assertTrue(not cls.cache.full_name) if "GCCXML" in utils.xml_generator: self.assertTrue(not cls.cache.demangled_name) self.assertTrue(not cls.cache.declaration_path) self.assertTrue(not enum.cache.full_name) if "GCCXML" in utils.xml_generator: self.assertTrue(not enum.cache.demangled_name) self.assertTrue(not enum.cache.declaration_path)
def test_name_based(self): cls = self.global_ns.class_(name='class_for_nested_enums_t') if self.xml_generator_from_xml_file.is_castxml: self.assertIsNone(cls.cache.demangled_name) elif self.xml_generator_from_xml_file.is_gccxml: self.assertTrue(cls.cache.demangled_name == cls.name) cls_full_name = declarations.full_name(cls) self.assertTrue(cls.cache.full_name == cls_full_name) cls_declaration_path = declarations.declaration_path(cls) self.assertTrue(cls.cache.declaration_path == cls_declaration_path) enum = cls.enumeration('ENestedPublic') enum_full_name = declarations.full_name(enum) self.assertTrue(enum.cache.full_name == enum_full_name) enum_declaration_path = declarations.declaration_path(enum) self.assertTrue(enum.cache.declaration_path == enum_declaration_path) # now we change class name, all internal decls cache should be cleared cls.name = "new_name" self.assertTrue(not cls.cache.full_name) if self.xml_generator_from_xml_file.is_gccxml: self.assertTrue(not cls.cache.demangled_name) self.assertTrue(not cls.cache.declaration_path) self.assertTrue(not enum.cache.full_name) if self.xml_generator_from_xml_file.is_gccxml: self.assertTrue(not enum.cache.demangled_name) self.assertTrue(not enum.cache.declaration_path)
def test_declaration_path(self): """ Test the deprecated with_defaults parameter """ with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") declarations.declaration_path(None, True) self._check(w)
def is_directive( self ): if None is self.__is_directive: dpath = declarations.declaration_path( self ) if len( dpath ) != 4: self.__is_directive = False else: self.__is_directive = dpath[:3] == ['::', 'pyplusplus', 'aliases'] return self.__is_directive
def is_directive(self): if None is self.__is_directive: dpath = declarations.declaration_path(self) if len(dpath) != 4: self.__is_directive = False else: self.__is_directive = dpath[:3] == ["::", "pyplusplus", "aliases"] return self.__is_directive
def is_directive(self): if None is self.__is_directive: dpath = declarations.declaration_path(self) if len(dpath) != 4: self.__is_directive = False else: self.__is_directive = dpath[:3] == [ '::', 'pyplusplus', 'aliases' ] return self.__is_directive
def __is_std_decl(self, decl): #Every class under std should be exported by Boost.Python and\\or `Py++` #Also this is not the case right now, I prefer to hide the warnings dpath = declarations.declaration_path(decl) if len(dpath) < 3: return False if dpath[1] != 'std': return False if decl.name.startswith('pair<'): #special case return False return True
def __is_std_decl( self, decl ): #Every class under std should be exported by Boost.Python and\\or Py++ #Also this is not the case right now, I prefer to hide the warnings dpath = declarations.declaration_path( decl ) if len( dpath ) < 3: return False if dpath[1] != 'std': return False if decl.name.startswith( 'pair<' ): #special case return False return True
def _create_namespaces(self): ns_names = declarations.declaration_path( self.declaration.parent ) if len(ns_names) >= 1 and ns_names[0] == '::': ns_names = ns_names[1:] return ns_names