本文整理汇总了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)