This commit is contained in:
Waylon Walker 2022-03-31 20:20:07 -05:00
commit 38355d2442
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
9083 changed files with 1225834 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import os
from unittest import mock, TestCase
from mypy.util import get_terminal_width
class TestGetTerminalSize(TestCase):
def test_get_terminal_size_in_pty_defaults_to_80(self) -> None:
# when run using a pty, `os.get_terminal_size()` returns `0, 0`
ret = os.terminal_size((0, 0))
mock_environ = os.environ.copy()
mock_environ.pop('COLUMNS', None)
with mock.patch.object(os, 'get_terminal_size', return_value=ret):
with mock.patch.dict(os.environ, values=mock_environ, clear=True):
assert get_terminal_width() == 80