Use two blank lines between classes and functions

This commit is contained in:
Elias Müller 2022-07-09 18:54:01 +02:00 committed by jaseg
parent 6a71ee0b9a
commit 0e19248d69

View file

@ -43,12 +43,14 @@ TESTVID = os.path.join(os.path.dirname(__file__), 'test.webm')
TESTSRT = os.path.join(os.path.dirname(__file__), 'sub_test.srt') TESTSRT = os.path.join(os.path.dirname(__file__), 'sub_test.srt')
MPV_ERRORS = [ l(ec) for ec, l in mpv.ErrorCode.EXCEPTION_DICT.items() if l ] MPV_ERRORS = [ l(ec) for ec, l in mpv.ErrorCode.EXCEPTION_DICT.items() if l ]
def timed_print(): def timed_print():
start_time = time.time() start_time = time.time()
def do_print(level, prefix, text): def do_print(level, prefix, text):
td = time.time() - start_time td = time.time() - start_time
print('{:.3f} [{}] {}: {}'.format(td, level, prefix, text), flush=True) print('{:.3f} [{}] {}: {}'.format(td, level, prefix, text), flush=True)
class MpvTestCase(unittest.TestCase): class MpvTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.disp = Xvfb() self.disp = Xvfb()
@ -59,6 +61,7 @@ class MpvTestCase(unittest.TestCase):
self.m.terminate() self.m.terminate()
self.disp.stop() self.disp.stop()
class TestProperties(MpvTestCase): class TestProperties(MpvTestCase):
@contextmanager @contextmanager
def swallow_mpv_errors(self, exception_exceptions=[]): def swallow_mpv_errors(self, exception_exceptions=[]):
@ -288,6 +291,7 @@ class ObservePropertyTest(MpvTestCase):
mock.call('slang', ['ru'])], mock.call('slang', ['ru'])],
any_order=True) any_order=True)
class KeyBindingTest(MpvTestCase): class KeyBindingTest(MpvTestCase):
def test_register_direct_cmd(self): def test_register_direct_cmd(self):
self.m.register_key_binding('a', 'playlist-clear') self.m.register_key_binding('a', 'playlist-clear')
@ -434,6 +438,7 @@ class KeyBindingTest(MpvTestCase):
handler1.assert_has_calls([]) handler1.assert_has_calls([])
handler2.assert_has_calls([ mock.call() ]) handler2.assert_has_calls([ mock.call() ])
class TestStreams(unittest.TestCase): class TestStreams(unittest.TestCase):
def test_python_stream(self): def test_python_stream(self):
handler = mock.Mock() handler = mock.Mock()
@ -529,6 +534,7 @@ class TestStreams(unittest.TestCase):
m.terminate() m.terminate()
disp.stop() disp.stop()
class TestLifecycle(unittest.TestCase): class TestLifecycle(unittest.TestCase):
def test_create_destroy(self): def test_create_destroy(self):
thread_names = lambda: [ t.name for t in threading.enumerate() ] thread_names = lambda: [ t.name for t in threading.enumerate() ]
@ -756,7 +762,6 @@ class CommandTests(MpvTestCase):
callback.assert_any_call(None, None) callback.assert_any_call(None, None)
class RegressionTests(MpvTestCase): class RegressionTests(MpvTestCase):
def test_unobserve_property_runtime_error(self): def test_unobserve_property_runtime_error(self):