WIP: #170 #172

Draft
edraft wants to merge 20 commits from #170 into master
Showing only changes of commit 2ec4af8bb3 - Show all commits

View File

@ -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