本文整理匯總了Python中autofixture.base.Link類的典型用法代碼示例。如果您正苦於以下問題:Python Link類的具體用法?Python Link怎麽用?Python Link使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Link類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_links_with_value
def test_links_with_value(self):
link = Link({'foo': 1, 'spam__egg': 2}, default=0)
self.assertTrue('foo' in link)
self.assertEqual(link['foo'], 1)
self.assertFalse('spam' in link)
self.assertEqual(link['spam'], 0)
spamlink = link.get_deep_links('spam')
self.assertTrue('egg' in spamlink)
self.assertEqual(spamlink['bar'], 0)
self.assertEqual(spamlink['egg'], 2)
示例2: test_nested_links
def test_nested_links(self):
link = Link(('foo', 'foo__bar', 'spam__ALL'))
self.assertTrue('foo' in link)
self.assertFalse('spam' in link)
self.assertFalse('egg' in link)
foolink = link.get_deep_links('foo')
self.assertTrue('bar' in foolink)
self.assertFalse('egg' in foolink)
spamlink = link.get_deep_links('spam')
self.assertTrue('bar' in spamlink)
self.assertTrue('egg' in spamlink)
示例3: test_always_true_link
def test_always_true_link(self):
link = Link(True)
self.assertTrue('field' in link)
self.assertTrue('any' in link)
link = link.get_deep_links('field')
self.assertTrue('field' in link)
self.assertTrue('any' in link)
link = Link(('ALL',))
self.assertTrue('field' in link)
self.assertTrue('any' in link)
link = link.get_deep_links('field')
self.assertTrue('field' in link)
self.assertTrue('any' in link)
示例4: test_inherit_always_true_value
def test_inherit_always_true_value(self):
link = Link({'ALL': 1})
self.assertEqual(link['foo'], 1)
sublink = link.get_deep_links('foo')
self.assertEqual(sublink['bar'], 1)