本文整理匯總了Python中collection_json.Array類的典型用法代碼示例。如果您正苦於以下問題:Python Array類的具體用法?Python Array怎麽用?Python Array使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Array類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_by_rel_and_name
def test_get_by_rel_and_name(self):
foo = Link('href', rel='foo', name='bar')
bar = Link('href', rel='bar')
links = Array(Link, 'links', [foo, bar])
with self.assertRaises(ValueError):
links.get(rel='bar', name='foo')
self.assertEqual(links.get(rel='foo', name='bar'), foo)
示例2: test_get_by_name_multiple
def test_get_by_name_multiple(self):
link1 = Link('href', rel='foo', name='bar')
link2 = Link('href', rel='foo', name='bar')
links = Array(Link, 'links', [link1, link2])
self.assertEqual(links.get(name='bar'), link1)
示例3: test_get_by_name
def test_get_by_name(self):
link = Link('href', rel='foo', name='bar')
links = Array(Link, 'links', [link])
self.assertEqual(links.get(name='bar'), link)
示例4: test_get_by_rel_not_found
def test_get_by_rel_not_found(self):
link = Link('href', rel='foo')
links = Array(Link, 'links', [link])
with self.assertRaises(ValueError):
links.get(rel='bar')
示例5: test_get_by_rel
def test_get_by_rel(self):
link = Link('href', rel='foo')
links = Array(Link, 'links', [link])
self.assertEqual(links.get(rel='foo'), link)
示例6: test_find_by_rel_and_name
def test_find_by_rel_and_name(self):
foo = Link('href', rel='foo', name='bar')
bar = Link('href', rel='bar')
links = Array(Link, 'links', [foo, bar])
self.assertEqual(links.find(rel='foo', name='bar'), [foo])
self.assertEqual(links.find(rel='bar', name='foo'), [])
示例7: test_find_by_name_multiple_values
def test_find_by_name_multiple_values(self):
link1 = Link('href1', rel='foo', name='bar')
link2 = Link('href2', rel='foo', name='bar')
links = Array(Link, 'links', [link1, link2])
self.assertEqual(links.find(name='bar'), [link1, link2])
示例8: test_find_by_name_not_found
def test_find_by_name_not_found(self):
link = Link('href', rel='foo', name='bar')
links = Array(Link, 'links', [link])
self.assertEqual(links.find(name='foo'), [])
示例9: test_find_by_rel
def test_find_by_rel(self):
link = Link('href', rel='foo')
links = Array(Link, 'links', [link])
self.assertEqual(links.find(rel='foo'), [link])