From b1f81ac56184a172f093b0a640890de9ded405d7 Mon Sep 17 00:00:00 2001 From: Matt Deacalion Stevens Date: Sun, 21 May 2017 10:58:36 +0100 Subject: Fix `unobserve_property` RuntimeError --- mpv-test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'mpv-test.py') diff --git a/mpv-test.py b/mpv-test.py index b2bea2e..21cb8cf 100755 --- a/mpv-test.py +++ b/mpv-test.py @@ -206,5 +206,32 @@ class TestLifecycle(unittest.TestCase): handler.assert_any_call('info', 'cplayer', 'Playing: ./test.webm') +class RegressionTests(unittest.TestCase): + + def test_unobserve_property_runtime_error(self): + """ + Ensure a `RuntimeError` is not thrown within + `unobserve_property`. + """ + handler = mock.Mock() + handler.observed_mpv_properties = [] + + m = mpv.MPV() + m.observe_property('loop', handler) + + try: + m.unobserve_property('loop', handler) + except RuntimeError: + self.fail( + """ + "RuntimeError" exception thrown within + `unobserve_property` + """, + ) + finally: + m.terminate() + + + if __name__ == '__main__': unittest.main() -- cgit