本文整理汇总了Python中test.unittest.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了main函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mdstat_raid5
'md0.bitmap.allocated_pages': 1,
'md0.bitmap.page_size': 4,
'md0.bitmap.chunk_size': 65536
}
self.assertPublishedMany(publish_mock, metrics)
@patch.object(Collector, 'publish')
def test_mdstat_raid5(self, publish_mock):
MdStatCollector.MDSTAT_PATH = \
self.getFixturePath('mdstat_raid5')
self.collector.collect()
metrics = {
'md0.status.total_members': 3,
'md0.status.blocks': 39058432,
'md0.status.algorithm': 2,
'md0.status.superblock_version': 1.2,
'md0.status.raid_level': 5,
'md0.status.chunk_size': 524288,
'md0.status.actual_members': 3,
'md0.member_count.active': 3,
'md0.member_count.faulty': 0,
'md0.member_count.spare': 0
}
self.assertPublishedMany(publish_mock, metrics)
if __name__ == "__main__":
unittest.main()
示例2: testNarrower
self.assertIn(key, concept.related)
match = concept.related[key]
self.assertIsInstance(match, skos.Concept)
self.assertIn(concept, match.related)
def testNarrower(self):
concept = self.loader['http://portal.oceannet.org/test2']
key = self.getExternalResource('external2-dce.xml')
self.assertIn(key, concept.narrower)
match = concept.narrower[key]
self.assertIsInstance(match, skos.Concept)
self.assertIn(concept, match.broader)
def testFlattening(self):
self.loader.flat = True
self.assertEqual(len(self.loader), 12)
self.assertIn(self.getExternalResource('external2-dce.xml'), self.loader)
class TestRDFUriNormalisation(TestRDFLoader):
"""
Test the uri normalisation functionality
"""
def getLoader(self, graph):
def normalise_uri(uri):
return uri.rstrip(u'/')
return skos.RDFLoader(graph, normalise_uri=normalise_uri)
if __name__ == '__main__':
unittest.main(verbosity=2)