当前位置: 首页>>代码示例>>Python>>正文


Python queryables.Queryable类代码示例

本文整理汇总了Python中asq.queryables.Queryable的典型用法代码示例。如果您正苦于以下问题:Python Queryable类的具体用法?Python Queryable怎么用?Python Queryable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Queryable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_select_deferred

 def test_select_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).select(lambda x: x*2)
     self.assertEqual(a.trace, [])
     c = b.take(3).to_list()
     self.assertEqual(a.trace, [0, 1, 2])
开发者ID:MartinFSchmitz,项目名称:101worker,代码行数:7,代码来源:test_select.py

示例2: test_take_is_deferred

 def test_take_is_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).take()
     self.assertEqual(a.trace, [])
     c = b.to_list()
     self.assertEqual(a.trace, [0])
开发者ID:GitHubTianPeng,项目名称:101worker,代码行数:7,代码来源:test_take.py

示例3: test_select_many_with_index_closed

 def test_select_many_with_index_closed(self):
     a = [{'name' : 'Alice', 'flowers' : ['Agapanthus', 'Allium', 'Alpina', 'Alstroemeria', 'Amaranthus', 'Amarylis' ] },
          {'name' : 'Bob',   'flowers' : ['Bouvardia' ]},
          {'name' : 'Chris', 'flowers' : ['Carnations', 'Cattleya', 'Celosia', 'Chincherinchee', 'Chrysanthemum']}]
     b = Queryable(a)
     b.close()
     self.assertRaises(ValueError, lambda: b.select_many_with_index(lambda i, x: [str(i) + flower for flower in x['flowers']]))
开发者ID:Dror-LightCyber,项目名称:asq,代码行数:7,代码来源:test_select_many_with_index.py

示例4: test_select_with_index_deferred

 def test_select_with_index_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).select_with_index()
     self.assertEqual(a.trace, [])
     b.take(3).to_list()
     self.assertEqual(a.trace, [0, 1, 2])
开发者ID:pombredanne,项目名称:asq,代码行数:7,代码来源:test_select_with_index.py

示例5: test_select_with_corresponding_deferred

 def test_select_with_corresponding_deferred(self):
     a = TracingGenerator()
     self.assertListEqual(a.trace, [])
     b = Queryable(a).select_with_correspondence(lambda x: x * 2)
     self.assertListEqual(a.trace, [])
     b.take(3).to_list()
     self.assertListEqual(a.trace, list(range(3)))
开发者ID:pombredanne,项目名称:asq,代码行数:7,代码来源:test_select_with_corresponding.py

示例6: test_group_join_is_deferred

 def test_group_join_is_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = [2, 3, 4, 5, 6]
     c = Queryable(a).group_join(b)
     self.assertEqual(a.trace, [])
     d = c.take(3).to_list()
开发者ID:Dror-LightCyber,项目名称:asq,代码行数:7,代码来源:test_group_join.py

示例7: test_select_many_deferred

 def test_select_many_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).select_many(lambda x: [x] * x)
     self.assertEqual(a.trace, [])
     b.take(10).to_list()
     self.assertEqual(a.trace, [0, 1, 2, 3, 4])
开发者ID:Dror-LightCyber,项目名称:asq,代码行数:7,代码来源:test_select_many.py

示例8: test_default_if_empty_is_deferred_not_empty

 def test_default_if_empty_is_deferred_not_empty(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).default_if_empty(42)
     self.assertEqual(a.trace, [])
     c = b.take(3).to_list()
     self.assertEqual(a.trace, [0, 1, 2])
开发者ID:pombredanne,项目名称:asq,代码行数:7,代码来源:test_default_if_empty.py

示例9: test_skip_is_deferred

 def test_skip_is_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).skip(3)
     self.assertEqual(a.trace, [])
     c = b.take().to_list()
     self.assertEqual(a.trace, [0, 1, 2, 3])
开发者ID:GitHubTianPeng,项目名称:101worker,代码行数:7,代码来源:test_skip.py

示例10: test_where_deferred

 def test_where_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).where(lambda x: x % 3 == 0)
     self.assertEqual(a.trace, [])
     c = b.take(2).to_list()
     self.assertEqual(a.trace, [0, 1, 2, 3])
开发者ID:Dror-LightCyber,项目名称:asq,代码行数:7,代码来源:test_where.py

示例11: test_select_many_with_index_deferred

 def test_select_many_with_index_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).select_many_with_index(lambda index, source_element: [source_element] * index)
     self.assertEqual(a.trace, [])
     b.take(10).to_list()
     self.assertEqual(a.trace, [0, 1, 2, 3, 4])
开发者ID:Dror-LightCyber,项目名称:asq,代码行数:7,代码来源:test_select_many_with_index.py

示例12: test_join_is_deferred

 def test_join_is_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = [2, 3, 4, 5, 6]
     c = Queryable(a).join(b)
     self.assertEqual(a.trace, [])
     d = c.take(3).to_list()
     e = [(2, 2), (3, 3), (4, 4)]
     self.assertEqual(d, e)
开发者ID:pombredanne,项目名称:asq,代码行数:9,代码来源:test_join.py

示例13: test_take_while_is_deferred

 def test_take_while_is_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = Queryable(a).take_while(lambda x: x < 3)
     self.assertEqual(a.trace, [])
     c = b.to_list()
     # 3 is included here in the trace because it must have been consumed in order to test
     # whether it satisfies the predicate
     self.assertEqual(a.trace, [0, 1, 2, 3])
开发者ID:GitHubTianPeng,项目名称:101worker,代码行数:9,代码来源:test_take_while.py

示例14: test_union_deferred

 def test_union_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = [3, 7, 2, 9, 10]
     c = Queryable(a).union(b)
     self.assertEqual(a.trace, [])
     d = c.take(5).to_list()
     e = [0, 1, 2, 3, 4]
     self.assertEqual(a.trace, e)
开发者ID:pombredanne,项目名称:asq,代码行数:9,代码来源:test_union.py

示例15: test_difference_deferred

 def test_difference_deferred(self):
     a = TracingGenerator()
     self.assertEqual(a.trace, [])
     b = [3, 7, 2, 9, 10]
     c = Queryable(a).difference(b)
     self.assertEqual(a.trace, [])
     d = c.take(10).to_list()
     e = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
     self.assertEqual(a.trace, e)
开发者ID:pombredanne,项目名称:asq,代码行数:9,代码来源:test_difference.py


注:本文中的asq.queryables.Queryable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。