Skip to content

Commit

Permalink
add test_listen_file_input to test_io
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzCutNorman committed Dec 8, 2023
1 parent 719652d commit 5eefa0e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/core/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from __future__ import annotations

import decimal
import sys
import typing as t
from contextlib import nullcontext

import msgspec
Expand All @@ -12,6 +14,11 @@


class DummyReader(SingerReader):
returned_file_input: t.IO = None

def _process_lines(self, file_input: t.IO) -> t.Counter[str]:
self.returned_file_input = file_input

def _process_activate_version_message(self, message_dict: dict) -> None:
pass

Expand Down Expand Up @@ -64,6 +71,24 @@ def test_enc_hook(test_value, expected_value):
assert returned == expected_value


@pytest.mark.parametrize(
"test_value,expected_value",
[
pytest.param(
None,
sys.stdin.buffer,
id="file_input_is_none",
),
],
)
def test_listen_file_input(test_value, expected_value):
reader = DummyReader()

reader.listen(test_value)

assert reader.returned_file_input is expected_value


@pytest.mark.parametrize(
"line,expected,exception",
[
Expand Down

0 comments on commit 5eefa0e

Please sign in to comment.