Skip to content

Commit

Permalink
fix: broken zsh test
Browse files Browse the repository at this point in the history
  • Loading branch information
purarue committed Nov 13, 2024
1 parent 7ef2ac9 commit 4f2fa34
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_zsh.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
from pathlib import Path
from typing import Callable, Iterator
from itertools import chain

from my.zsh import history, Entry
from my.zsh import _parse_file, _merge_histories, Entry

from .common import data

history_file = data("zsh/zsh_history")
overlap_file = data("zsh/overlap_history")


def _parse_and_merge(inputs: Callable[[], Iterator[Path]]) -> Iterator[Entry]:
yield from _merge_histories(*chain(map(_parse_file, inputs())))


def test_single_file() -> None:
"""
test that a single zsh parse works and for an entry in the history
Expand All @@ -16,7 +22,7 @@ def test_single_file() -> None:
def zsh_small_test():
yield Path(history_file)

items = list(history(from_paths=zsh_small_test))
items = list(_parse_and_merge(inputs=zsh_small_test))
assert len(items) == 11

from datetime import datetime, timezone
Expand Down Expand Up @@ -47,5 +53,5 @@ def zsh_multiple_tests():
yield Path(history_file)
yield Path(overlap_file)

items = list(history(from_paths=zsh_multiple_tests))
items = list(_parse_and_merge(inputs=zsh_multiple_tests))
assert len(items) == 11

0 comments on commit 4f2fa34

Please sign in to comment.