Skip to content

Commit

Permalink
feat: support columns out of order in Metric
Browse files Browse the repository at this point in the history
  • Loading branch information
nh13 authored Dec 22, 2023
1 parent 0c5d6ff commit 5ac2bbe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fgpyo/util/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,18 @@ def test_metrics_fast_concat(tmp_path: Path) -> None:
assert metrics[0] == DUMMY_METRICS[0]
assert metrics[1] == DUMMY_METRICS[1]
assert metrics[2] == DUMMY_METRICS[2]


def test_metric_columns_out_of_order(tmp_path: Path) -> None:
path = tmp_path / "metrics.txt"

name = Name(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)
assert len(names) == 1
assert names[0] == name

0 comments on commit 5ac2bbe

Please sign in to comment.