Skip to content

Commit

Permalink
updated test format to sort input
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheww95 committed Apr 23, 2024
1 parent 207b2d3 commit 67e8cfe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import os
import json
import itertools
from dataclasses import dataclass

EXPECTED_DATA_OUT = "locidex/example/format_db_mlst_out"
Expand Down Expand Up @@ -60,8 +59,9 @@ def test_formatted_db_content(output_directory):
actual_file = os.path.join(output_directory, formatted_file)
expected_file = os.path.join(EXPECTED_DATA_OUT, formatted_file)
with open(actual_file, 'r') as act, open(expected_file, 'r') as expc:
actual_text = sorted(itertools.chain(act.readlines()).split(delimiter), key=lambda x: x[0])
expected_text = sorted(itertools.chain(*expc.readlines()).split(delimiter), key=lambda x: x[0])
sort_key = lambda x: x.split(delimiter)[0]
actual_text = sorted(act.readlines(), key=sort_key)
expected_text = sorted(expc.readlines(), key=sort_key)
assert hash(" ".join(actual_text)) == hash(" ".join(expected_text))

def test_format_results(output_directory):
Expand Down

0 comments on commit 67e8cfe

Please sign in to comment.