我们从Python开源项目中,提取了以下30个代码示例,用于说明如何使用email.__version__()。
def testModuleExtract(self): if not hasattr(dep, 'get_module_constant'): # skip on non-bytecode platforms return from email import __version__ self.assertEqual( dep.get_module_constant('email','__version__'), __version__ ) self.assertEqual( dep.get_module_constant('sys','version'), sys.version ) self.assertEqual( dep.get_module_constant('setuptools.tests','__doc__'),__doc__ )
def testRequire(self): if not hasattr(dep, 'extract_constant'): # skip on non-bytecode platformsh return req = Require('Email','1.0.3','email') self.assertEqual(req.name, 'Email') self.assertEqual(req.module, 'email') self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') self.assertEqual(req.full_name(), 'Email-1.0.3') from email import __version__ self.assertEqual(req.get_version(), __version__) self.assertTrue(req.version_ok('1.0.9')) self.assertTrue(not req.version_ok('0.9.1')) self.assertTrue(not req.version_ok('unknown')) self.assertTrue(req.is_present()) self.assertTrue(req.is_current()) req = Require('Email 3000','03000','email',format=LooseVersion) self.assertTrue(req.is_present()) self.assertTrue(not req.is_current()) self.assertTrue(not req.version_ok('unknown')) req = Require('Do-what-I-mean','1.0','d-w-i-m') self.assertTrue(not req.is_present()) self.assertTrue(not req.is_current()) req = Require('Tests', None, 'tests', homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) self.assertEqual(req.full_name(), 'Tests') self.assertEqual(req.homepage, 'http://example.com') paths = [os.path.dirname(p) for p in __path__] self.assertTrue(req.is_present(paths)) self.assertTrue(req.is_current(paths))
def testModuleExtract(self): from email import __version__ assert dep.get_module_constant('email','__version__') == __version__ assert dep.get_module_constant('sys','version') == sys.version assert dep.get_module_constant('setuptools.tests','__doc__') == __doc__
def testRequire(self): req = Require('Email','1.0.3','email') assert req.name == 'Email' assert req.module == 'email' assert req.requested_version == '1.0.3' assert req.attribute == '__version__' assert req.full_name() == 'Email-1.0.3' from email import __version__ assert req.get_version() == __version__ assert req.version_ok('1.0.9') assert not req.version_ok('0.9.1') assert not req.version_ok('unknown') assert req.is_present() assert req.is_current() req = Require('Email 3000','03000','email',format=LooseVersion) assert req.is_present() assert not req.is_current() assert not req.version_ok('unknown') req = Require('Do-what-I-mean','1.0','d-w-i-m') assert not req.is_present() assert not req.is_current() req = Require('Tests', None, 'tests', homepage="http://example.com") assert req.format is None assert req.attribute is None assert req.requested_version is None assert req.full_name() == 'Tests' assert req.homepage == 'http://example.com' paths = [os.path.dirname(p) for p in __path__] assert req.is_present(paths) assert req.is_current(paths)
def testModuleExtract(self): from email import __version__ assert dep.get_module_constant('email', '__version__') == __version__ assert dep.get_module_constant('sys', 'version') == sys.version assert dep.get_module_constant('setuptools.tests', '__doc__') == __doc__
def testRequire(self): req = Require('Email', '1.0.3', 'email') assert req.name == 'Email' assert req.module == 'email' assert req.requested_version == '1.0.3' assert req.attribute == '__version__' assert req.full_name() == 'Email-1.0.3' from email import __version__ assert req.get_version() == __version__ assert req.version_ok('1.0.9') assert not req.version_ok('0.9.1') assert not req.version_ok('unknown') assert req.is_present() assert req.is_current() req = Require('Email 3000', '03000', 'email', format=LooseVersion) assert req.is_present() assert not req.is_current() assert not req.version_ok('unknown') req = Require('Do-what-I-mean', '1.0', 'd-w-i-m') assert not req.is_present() assert not req.is_current() req = Require('Tests', None, 'tests', homepage="http://example.com") assert req.format is None assert req.attribute is None assert req.requested_version is None assert req.full_name() == 'Tests' assert req.homepage == 'http://example.com' paths = [os.path.dirname(p) for p in __path__] assert req.is_present(paths) assert req.is_current(paths)