示例#1
0
 def test_call(self):
     f = Mock()
     f2 = Mock()
     chute = Chute.create(f)()
     chute.to(Chute.create(f2)())
     chute()
     assert f.called
     assert f2.called
示例#2
0
 def test_call(self):
     f = Mock()
     f2 = Mock()
     chute = Chute.create(f)()
     chute.to(Chute.create(f2)())
     chute()
     assert f.called
     assert f2.called
示例#3
0
 def test_to_with_unintialized_chute(self):
     chute = Chute.create(Mock())()
     cb = Chute.create(Mock())
     chute.to(cb)
     assert chute.callbacks
     assert isinstance(chute.callbacks[0], cb)
示例#4
0
 def test_rshift(self):
     chute = Chute.create(Mock())()
     cb = Chute.create(Mock())()
     result = chute >> cb
     assert result is cb
     assert cb in chute.callbacks
示例#5
0
 def test_to(self):
     chute = Chute.create(Mock())()
     cb = Chute.create(Mock())()
     result = chute.to(cb)
     assert result is cb
     assert cb in chute.callbacks
示例#6
0
 def test_callbacks(self):
     f = Mock()
     chute = Chute.create(f)()
     assert chute.callbacks == []
     chute.callbacks.append("foo")
     assert "foo" in chute.callbacks
示例#7
0
 def test_runs(self):
     f = Mock(returns=["path/to/file.ufo"])
     chute = Chute.create(f)()
     assert chute.run([]) == ["path/to/file.ufo"]
示例#8
0
 def test_init(self):
     f = Mock()
     chute = Chute.create(f)()
     assert not f.called
     assert len(chute.callbacks) == 0
示例#9
0
 def test_to_with_unintialized_chute(self):
     chute = Chute.create(Mock())()
     cb = Chute.create(Mock())
     chute.to(cb)
     assert chute.callbacks
     assert isinstance(chute.callbacks[0], cb)
示例#10
0
 def test_rshift(self):
     chute = Chute.create(Mock())()
     cb = Chute.create(Mock())()
     result = chute >> cb
     assert result is cb
     assert cb in chute.callbacks
示例#11
0
 def test_to(self):
     chute = Chute.create(Mock())()
     cb = Chute.create(Mock())()
     result = chute.to(cb)
     assert result is cb
     assert cb in chute.callbacks
示例#12
0
 def test_callbacks(self):
     f = Mock()
     chute = Chute.create(f)()
     assert chute.callbacks == []
     chute.callbacks.append("foo")
     assert "foo" in chute.callbacks
示例#13
0
 def test_runs(self):
     f = Mock(returns=["path/to/file.ufo"])
     chute = Chute.create(f)()
     assert chute.run([]) == ["path/to/file.ufo"]
示例#14
0
 def test_init(self):
     f = Mock()
     chute = Chute.create(f)()
     assert not f.called
     assert len(chute.callbacks) == 0