| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
import unittest |
| 14 |
|
| 15 |
import fixtures |
| 16 |
|
| 17 |
from autopage.tests import sinks |
| 18 |
|
| 19 |
import autopage |
| 20 |
|
| 21 |
|
| 22 |
class LineBufferFromInputTest(unittest.TestCase): |
| 23 |
def test_tty(self) -> None: |
| 24 |
with sinks.TTYFixture() as inp: |
| 25 |
self.assertTrue(autopage.line_buffer_from_input(inp.stream)) |
| 26 |
|
| 27 |
def test_file(self) -> None: |
| 28 |
with sinks.TempFixture() as inp: |
| 29 |
self.assertFalse(autopage.line_buffer_from_input(inp.stream)) |
| 30 |
|
| 31 |
def test_default_tty(self) -> None: |
| 32 |
with sinks.TTYFixture() as inp: |
| 33 |
with fixtures.MonkeyPatch('sys.stdin', inp.stream): |
| 34 |
self.assertTrue(autopage.line_buffer_from_input()) |
| 35 |
|
| 36 |
def test_default_file(self) -> None: |
| 37 |
with sinks.TempFixture() as inp: |
| 38 |
with fixtures.MonkeyPatch('sys.stdin', inp.stream): |
| 39 |
self.assertFalse(autopage.line_buffer_from_input()) |