示例#1
0
文件: test_base.py 项目: chmp/flowly
 def test_this_call(self):
     assert ord('a') == +(pipe(ord) | this('a'))
示例#2
0
文件: test_base.py 项目: chmp/flowly
 def test_this_div(self):
     self.assertEqual(3, +(pipe(21) | this / 7))
     self.assertEqual(3, +(pipe(7) | 21 / this))
示例#3
0
文件: test_base.py 项目: chmp/flowly
 def test_this_pow(self):
     assert 8 == +(pipe(2) | this ** 3)
     assert 8 == +(pipe(3) | 2 ** this)
示例#4
0
文件: test_base.py 项目: chmp/flowly
 def test_pipe_logical_expressions(self):
     self.assertEqual(0, +(pipe(1) | (this | 0) | (this & 0)))
示例#5
0
文件: test_base.py 项目: chmp/flowly
 def test_this_sub(self):
     self.assertEqual(7, +(pipe(21) | this - 14))
     self.assertEqual(7, +(pipe(14) | 21 - this))
示例#6
0
文件: test_base.py 项目: chmp/flowly
 def test_base_behavior(self):
     self.assertEqual(5, +(pipe(3) | foo()))
示例#7
0
文件: test_base.py 项目: chmp/flowly
 def test_picle_unpickle(self):
     self.assertEqual(5, +(pipe(3) | pickle.loads(pickle.dumps(foo))()))
示例#8
0
文件: test_base.py 项目: chmp/flowly
 def test_this_mul(self):
     self.assertEqual(21, +(pipe(7) | this * 3))
     self.assertEqual(21, +(pipe(7) | 3 * this))
示例#9
0
文件: test_base.py 项目: chmp/flowly
 def test_this_div(self):
     self.assertEqual(3, +(pipe(21) | this / 7))
     self.assertEqual(3, +(pipe(7) | 21 / this))
示例#10
0
文件: test_base.py 项目: chmp/flowly
 def test_this_add(self):
     self.assertEqual(3, +(pipe(2) | this + 1))
     self.assertEqual(3, +(pipe(2) | 1 + this))
示例#11
0
文件: test_base.py 项目: chmp/flowly
 def test_this_sub(self):
     self.assertEqual(7, +(pipe(21) | this - 14))
     self.assertEqual(7, +(pipe(14) | 21 - this))
示例#12
0
文件: test_base.py 项目: chmp/flowly
 def test_pipe_logical_expressions(self):
     self.assertEqual(0, +(pipe(1) | (this | 0) | (this & 0)))
示例#13
0
文件: test_base.py 项目: chmp/flowly
 def test_unbound_pipe(self):
     transform = pipe() | this * 2 | this + 4
     self.assertEqual(8, +(pipe(2) | transform))
示例#14
0
文件: test_base.py 项目: chmp/flowly
 def test_picle_unpickle(self):
     self.assertEqual(5, +(pipe(3) | pickle.loads(pickle.dumps(foo))()))
示例#15
0
文件: test_base.py 项目: chmp/flowly
 def test_this_getitem(self):
     assert 2 == +(pipe(dict(a=1, b=2)) | this['b'])
示例#16
0
文件: test_base.py 项目: chmp/flowly
 def test_this_floordir(self):
     assert 3 == +(pipe(24) | this // 7)
     assert 3 == +(pipe(7) | 24 // this)
示例#17
0
文件: test_base.py 项目: chmp/flowly
 def test_lit_call(self):
     assert ord('a') == +(pipe('a') | lit(ord)(this))
示例#18
0
文件: test_base.py 项目: chmp/flowly
 def test_this_pow(self):
     assert 8 == +(pipe(2) | this**3)
     assert 8 == +(pipe(3) | 2**this)
示例#19
0
文件: test_base.py 项目: chmp/flowly
 def test_base_behavior(self):
     self.assertEqual(5, +(pipe(3) | foo()))
示例#20
0
文件: test_base.py 项目: chmp/flowly
 def test_this_abs(self):
     assert 1 == +(pipe(-1) | abs(this))
示例#21
0
文件: test_base.py 项目: chmp/flowly
 def test_unbound_pipe(self):
     transform = pipe() | this * 2 | this + 4
     self.assertEqual(8, +(pipe(2) | transform))
示例#22
0
文件: test_base.py 项目: chmp/flowly
 def test_this_call(self):
     assert ord('a') == +(pipe(ord) | this('a'))
示例#23
0
文件: test_base.py 项目: chmp/flowly
 def test_this_add(self):
     self.assertEqual(3, +(pipe(2) | this + 1))
     self.assertEqual(3, +(pipe(2) | 1 + this))
示例#24
0
文件: test_base.py 项目: chmp/flowly
 def test_this_attr_call(self):
     assert [1, 2,
             3] == +(pipe(dict(a=1, b=2, c=3)) | this.values() | sorted)
示例#25
0
文件: test_base.py 项目: chmp/flowly
 def test_this_mul(self):
     self.assertEqual(21, +(pipe(7) | this * 3))
     self.assertEqual(21, +(pipe(7) | 3 * this))
示例#26
0
文件: test_base.py 项目: chmp/flowly
 def test_this_getitem(self):
     assert 2 == +(pipe(dict(a=1, b=2)) | this['b'])
示例#27
0
文件: test_base.py 项目: chmp/flowly
 def test_this_floordir(self):
     assert 3 == +(pipe(24) | this // 7)
     assert 3 == +(pipe(7) | 24 // this)
示例#28
0
文件: test_base.py 项目: chmp/flowly
 def test_lit(self):
     assert 1 == +(pipe(2) | lit(1))
示例#29
0
文件: test_base.py 项目: chmp/flowly
 def test_this_abs(self):
     assert 1 == +(pipe(-1) | abs(this))
示例#30
0
文件: test_base.py 项目: chmp/flowly
 def test_lit_call(self):
     assert ord('a') == +(pipe('a') | lit(ord)(this))
示例#31
0
文件: test_base.py 项目: chmp/flowly
 def test_this_attr_call(self):
     assert [1, 2, 3] == +(pipe(dict(a=1, b=2, c=3)) | this.values() | sorted)
示例#32
0
文件: test_base.py 项目: chmp/flowly
 def test_pipe_callables(self):
     self.assertEqual(8, +(pipe(2) | (lambda x: x * 2) | (lambda x: x + 4)))
示例#33
0
文件: test_base.py 项目: chmp/flowly
 def test_lit(self):
     assert 1 == +(pipe(2) | lit(1))
示例#34
0
文件: test_base.py 项目: chmp/flowly
 def test_pipe_this(self):
     self.assertEqual(8, +(pipe(2) | this * 2 | this + 4))
示例#35
0
文件: test_base.py 项目: chmp/flowly
 def test_pipe_callables(self):
     self.assertEqual(8, +(pipe(2) | (lambda x: x * 2) | (lambda x: x + 4)))
示例#36
0
文件: test_base.py 项目: chmp/flowly
 def test_pipe_this(self):
     self.assertEqual(8, +(pipe(2) | this * 2 | this + 4))