Improved tests
This commit is contained in:
parent
30b163a440
commit
2ec4af8bb3
@ -71,18 +71,23 @@ class ReactiveTestCase(unittest.TestCase):
|
||||
|
||||
Timer(1.0, complete).start()
|
||||
|
||||
time.sleep(2)
|
||||
def test_observer_completed(self):
|
||||
reached = False
|
||||
|
||||
def _test_complete(x: Observer):
|
||||
nonlocal reached
|
||||
|
||||
x.next(1)
|
||||
x.next(2)
|
||||
x.complete()
|
||||
reached = True
|
||||
x.next(3)
|
||||
|
||||
observable2 = Observable(_test_complete)
|
||||
observable = Observable(_test_complete)
|
||||
|
||||
observable2.subscribe(lambda x: x, self._on_error)
|
||||
self.assertTrue(self._error)
|
||||
observable.subscribe(lambda x: Console.write_line(1, x), self._on_error)
|
||||
self.assertFalse(reached)
|
||||
self.assertFalse(self._error)
|
||||
|
||||
def test_observable_from(self):
|
||||
expected_x = 1
|
||||
|
Loading…
Reference in New Issue
Block a user