Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nh13 authored Dec 22, 2023
1 parent 5ac2bbe commit 1499c49
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fgpyo/util/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def parse(cls, value: str) -> "Name":
return Name(first=fields[0], last=fields[1])


@attr.s(auto_attribs=True, frozen=True)
class NameMetric(Metric["NameMetric"]):
first: str
last: str


@attr.s(auto_attribs=True, frozen=True)
class NamedPerson(Metric["NamedPerson"]):
name: Name
Expand Down Expand Up @@ -348,13 +354,13 @@ def test_metrics_fast_concat(tmp_path: Path) -> None:
def test_metric_columns_out_of_order(tmp_path: Path) -> None:
path = tmp_path / "metrics.txt"

name = Name(first="jon", last="Doe")
name = NameMetric(first="jon", last="Doe")

# Write the columns out of order (last then first)
with path.open("w") as writer:
writer.write("last\tfirst\n")
writer.write(f"{name.last}\t{name.first}\n")

names = Name.read(path=path)
names = NameMetric.read(path=path)
assert len(names) == 1
assert names[0] == name

0 comments on commit 1499c49

Please sign in to comment.