diff --git a/unittests/unittests_reactive_extenstions/reactive_test_case.py b/unittests/unittests_reactive_extenstions/reactive_test_case.py index a0cff291..f6647707 100644 --- a/unittests/unittests_reactive_extenstions/reactive_test_case.py +++ b/unittests/unittests_reactive_extenstions/reactive_test_case.py @@ -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