diff options
| author | David Lechner | 2020-03-22 21:26:08 -0500 |
|---|---|---|
| committer | Damien George | 2020-03-30 13:21:58 +1100 |
| commit | 3dc324d3f1312e40d3a8ed87e7244966bb756f26 (patch) | |
| tree | 94ff44f8eabba0039582c245b901173597edd11e /tests/misc/sys_settrace_subdir | |
| parent | 488613bca6c460340ed2995ae5cafafe22d0bfff (diff) | |
tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with
./tools/codeformat.py. The basics/ subdirectory is excluded for now so we
aren't changing too much at once.
In a few places `# fmt: off`/`# fmt: on` was used where the code had
special formatting for readability or where the test was actually testing
the specific formatting.
Diffstat (limited to 'tests/misc/sys_settrace_subdir')
| -rw-r--r-- | tests/misc/sys_settrace_subdir/trace_generic.py | 20 | ||||
| -rw-r--r-- | tests/misc/sys_settrace_subdir/trace_importme.py | 6 |
2 files changed, 20 insertions, 6 deletions
diff --git a/tests/misc/sys_settrace_subdir/trace_generic.py b/tests/misc/sys_settrace_subdir/trace_generic.py index 3239a019c..111a9d19f 100644 --- a/tests/misc/sys_settrace_subdir/trace_generic.py +++ b/tests/misc/sys_settrace_subdir/trace_generic.py @@ -7,14 +7,15 @@ def test_func(): test_sub_func() + # closure def test_closure(msg): - def make_closure(): print(msg) return make_closure + # exception def test_exception(): try: @@ -22,41 +23,49 @@ def test_exception(): except Exception: pass - + finally: pass + # listcomp def test_listcomp(): print("test_listcomp", [x for x in range(3)]) + # lambda def test_lambda(): func_obj_1 = lambda a, b: a + b print(func_obj_1(10, 20)) + # import def test_import(): from sys_settrace_subdir import trace_importme + trace_importme.dummy() trace_importme.saysomething() + # class -class TLClass(): +class TLClass: def method(): pass + pass + def test_class(): class TestClass: __anynum = -9 + def method(self): print("test_class_method") self.__anynum += 1 - + def prprty_getter(self): return self.__anynum - + def prprty_setter(self, what): self.__anynum = what @@ -79,4 +88,5 @@ def run_tests(): test_class() test_import() + print("And it's done!") diff --git a/tests/misc/sys_settrace_subdir/trace_importme.py b/tests/misc/sys_settrace_subdir/trace_importme.py index 0ff7c6d5b..de561ef21 100644 --- a/tests/misc/sys_settrace_subdir/trace_importme.py +++ b/tests/misc/sys_settrace_subdir/trace_importme.py @@ -3,7 +3,7 @@ print("Yep, I got imported.") try: x = const(1) except NameError: - print('const not defined') + print("const not defined") const = lambda x: x @@ -12,13 +12,17 @@ _CNT02 = const(123) A123 = const(123) a123 = const(123) + def dummy(): return False + def saysomething(): print("There, I said it.") + def neverexecuted(): print("Never got here!") + print("Yep, got here") |
