(isatty)
| 73 | @mock.patch("sys.platform", "linux") |
| 74 | @mock.patch("sys.stdout.isatty") |
| 75 | def test_pformat_no_pygments(isatty): |
| 76 | isatty.return_value = True |
| 77 | |
| 78 | real_import = builtins.__import__ |
| 79 | |
| 80 | def mock_import(name, globals_, locals_, fromlist, level): |
| 81 | if "pygments" in name: |
| 82 | raise ImportError |
| 83 | return real_import(name, globals_, locals_, fromlist, level) |
| 84 | |
| 85 | builtins.__import__ = mock_import |
| 86 | assert pformat(value) == plain_string |
| 87 | builtins.__import__ = real_import |
| 88 | |
| 89 | |
| 90 | def test_pprint(): |