(self)
| 1890 | |
| 1891 | @force_not_colorized |
| 1892 | def test_exposed_globals_in_repl(self): |
| 1893 | pre = "['__builtins__'" |
| 1894 | post = "'__loader__', '__name__', '__package__', '__spec__']" |
| 1895 | output, exit_code = self.run_repl(["sorted(dir())", "exit()"], skip=True) |
| 1896 | self.assertEqual(exit_code, 0) |
| 1897 | |
| 1898 | # if `__main__` is not a file (impossible with pyrepl) |
| 1899 | case1 = f"{pre}, '__doc__', {post}" in output |
| 1900 | |
| 1901 | # if `__main__` is an uncached .py file (no .pyc) |
| 1902 | case2 = f"{pre}, '__doc__', '__file__', {post}" in output |
| 1903 | |
| 1904 | # if `__main__` is a cached .pyc file and the .py source exists |
| 1905 | case3 = f"{pre}, '__doc__', '__file__', {post}" in output |
| 1906 | |
| 1907 | # if `__main__` is a cached .pyc file but there's no .py source file |
| 1908 | case4 = f"{pre}, '__doc__', {post}" in output |
| 1909 | |
| 1910 | self.assertTrue(case1 or case2 or case3 or case4, output) |
| 1911 | |
| 1912 | def _assertMatchOK( |
| 1913 | self, var: str, expected: str | re.Pattern, actual: str |
nothing calls this directly
no test coverage detected