Skip to content

Commit

Permalink
fixup! test_dir_traversal: Document the .add() calls set up in test v…
Browse files Browse the repository at this point in the history
…ectors
  • Loading branch information
jherland committed Nov 15, 2023
1 parent 2bf2a8c commit 38de611
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_dir_traversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from pathlib import Path
from typing import Generic, List, NamedTuple, Optional, Tuple, TypeVar, Union
from typing import Generic, List, Optional, Tuple, TypeVar, Union

import pytest

Expand Down Expand Up @@ -89,14 +89,15 @@ def prepare(self, tmp_path: Path) -> TraversalStep:
)


class AddCall(NamedTuple, Generic[T]):
@dataclass(frozen=True)
class AddCall(Generic[T]):
"""Arguments for a call to DirectoryTraversal.add()."""

path: Union[Path, str]
attach: Tuple[T, ...] = ()


@dataclass
@dataclass(frozen=True)
class DirectoryTraversalVector(Generic[T]):
"""Test vectors for DirectoryTraversal."""

Expand Down Expand Up @@ -267,8 +268,8 @@ def test_DirectoryTraversal(vector: DirectoryTraversalVector, tmp_path):
entry(tmp_path)

traversal: DirectoryTraversal = DirectoryTraversal()
for path, data_items in vector.add:
traversal.add(tmp_path / path, *data_items)
for call in vector.add:
traversal.add(tmp_path / call.path, *call.attach)
for path in vector.skip_dirs:
traversal.skip_dir(tmp_path / path)

Expand Down

0 comments on commit 38de611

Please sign in to comment.