Skip to content

Commit

Permalink
fix tests after changes to yield_lines_from_object function
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ging committed Jan 22, 2024
1 parent edaf3e3 commit ecc3c11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/packg/iotools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .file_reader import (
yield_chunked_bytes,
yield_lines_from_file,
yield_lines_from_object,
read_bytes_from_file_or_io,
read_text_from_file_or_io,
open_file_or_io,
Expand Down Expand Up @@ -39,6 +40,7 @@
"set_working_directory",
"yield_chunked_bytes",
"yield_lines_from_file",
"yield_lines_from_object",
"load_json",
"loads_json",
"load_jsonl",
Expand Down
4 changes: 2 additions & 2 deletions src/packg/iotools/git_status_checker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from typing import Dict

from packg.iotools.file_reader import yield_lines_from_file
from packg.iotools.file_reader import yield_lines_from_object
from packg.iotools.misc import set_working_directory
from packg.system import systemcall_with_assert
from packg.typext import PathType
Expand All @@ -23,7 +23,7 @@ def parse_gitadd_dryrun_output(
Alternative way to do this would be git status: https://git-scm.com/docs/git-status#_output
"""
files = {}
for line in yield_lines_from_file(output.splitlines()):
for line in yield_lines_from_object(output.splitlines()):
line_split = line.split(" ")
status = line_split[0].strip()
file = " ".join(line_split[1:]).strip()[1:-1]
Expand Down
3 changes: 2 additions & 1 deletion tests/packg/test_iotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
read_text_from_file_or_io,
read_bytes_from_file_or_io,
yield_lines_from_file,
yield_lines_from_object,
find_git_root,
sort_file_paths_with_dirs_separated,
)
Expand Down Expand Up @@ -43,7 +44,7 @@ def test_read_bytes_from_file_or_io(tmp_path):
ids=["str", "io", "list"],
)
def test_yield_nonempty_stripped_lines(inp, ref):
cand = list(yield_lines_from_file(inp))
cand = list(yield_lines_from_object(inp))
assert cand == ref


Expand Down

0 comments on commit ecc3c11

Please sign in to comment.