• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python queryables.Queryable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_intersect_deferred

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


示例17: test_zip_deferred

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


示例18: test_skip_closed

 def test_skip_closed(self):
     a = ['a', 'b', 'c']
     b = Queryable(a)
     b.close()
     self.assertRaises(ValueError, lambda: b.skip(1))
开发者ID:GitHubTianPeng,项目名称:101worker,代码行数:5,代码来源:test_skip.py


示例19: test_getitem_closed

 def test_getitem_closed(self):
     b = Queryable([1])
     b.close()
     self.assertRaises(ValueError, lambda: b[0])
开发者ID:Dror-LightCyber,项目名称:asq,代码行数:4,代码来源:test_getitem.py


示例20: test_first_closed

 def test_first_closed(self):
     a = ['Agapanthus', 'Allium', 'Alpina', 'Alstroemeria', 'Amaranthus', 'Amarylis', 'Bouvardia', 'Carnations',
          'Cattleya', 'Celosia', 'Chincherinchee', 'Chrysanthemum']
     b = Queryable(a)
     b.close()
     self.assertRaises(ValueError, lambda: b.group_by(lambda x: x[0]))
开发者ID:GitHubTianPeng,项目名称:101worker,代码行数:6,代码来源:test_group_by.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_queryable.infinite函数代码示例发布时间:2022-05-24
下一篇:
Python initiators.query函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap