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