(self)
| 6622 | |
| 6623 | @unittest.skipIf(not has_subprocess_support, "test requires subprocess") |
| 6624 | def test_getsource(self): |
| 6625 | output = self.run_on_interactive_mode(textwrap.dedent("""\ |
| 6626 | def f(): |
| 6627 | print(0) |
| 6628 | return 1 + 2 |
| 6629 | |
| 6630 | import inspect |
| 6631 | print(f"The source is: <<<{inspect.getsource(f)}>>>") |
| 6632 | """)) |
| 6633 | |
| 6634 | expected = "The source is: <<<def f():\n print(0)\n return 1 + 2\n>>>" |
| 6635 | self.assertIn(expected, output) |
| 6636 | |
| 6637 | |
| 6638 |
nothing calls this directly
no test coverage detected