This repository has been archived by the owner on May 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v0.9.x-20170218-01-remove_copy_from' into v0.9.x
- Loading branch information
Showing
11 changed files
with
178 additions
and
263 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,47 @@ | ||
from AlphaTwirl.Loop import EventLoopRunner | ||
import unittest | ||
from AlphaTwirl.Loop import EventLoopRunner | ||
|
||
##__________________________________________________________________|| | ||
class MockResult(object): pass | ||
|
||
##__________________________________________________________________|| | ||
class MockEventLoop(object): | ||
def __init__(self): | ||
self.called = False | ||
def __init__(self, result): | ||
self.result = result | ||
|
||
def __call__(self, progressReporter): | ||
self.called = True | ||
return self.result | ||
|
||
##__________________________________________________________________|| | ||
class TestEventLoopRunner(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.runner = EventLoopRunner() | ||
self.obj = EventLoopRunner() | ||
|
||
def test_repr(self): | ||
repr(self.obj) | ||
|
||
def test_begin(self): | ||
self.runner.begin() | ||
self.obj.begin() | ||
|
||
def test_end(self): | ||
self.obj.begin() | ||
self.assertEqual([ ], self.obj.end()) | ||
|
||
def test_end_without_begin(self): | ||
self.assertEqual([ ], self.obj.end()) | ||
|
||
def test_run(self): | ||
loop = MockEventLoop() | ||
self.assertFalse(loop.called) | ||
self.runner.run(loop) | ||
self.assertTrue(loop.called) | ||
self.obj.begin() | ||
|
||
def test_end(self): | ||
self.runner.end() | ||
result1 = MockResult() | ||
loop1 = MockEventLoop(result1) | ||
self.obj.run(loop1) | ||
|
||
result2 = MockResult() | ||
loop2 = MockEventLoop(result2) | ||
self.obj.run(loop2) | ||
|
||
self.assertEqual([result1, result2], self.obj.end()) | ||
|
||
##__________________________________________________________________|| |
Oops, something went wrong.