pyerrors/tests/utils_in_test.py
Justus Kuhlmann 41fec09816
Impr/fix refactor sfcf read (#164)
* refactor read_sfcf

* adding tests for find_corr and read_compact_file

* add necessary broken data for tests

* fixed appended mode reading

* factored out sort_names and find_files

* now also using sort_files in sfcf.py

* edited tests to fit with new structure

* added find_files function

* shifted helpfunctions to bottom of file

* removed some debug lines

* linting

* Fixed requested changes, added silent mode

* added Exception if correlator is not found by read_append_rep

* use tmp_path fixture

* linting silent keyword

* try to fix testing for a_bb

* tests: Exception testing in test_find_corr made more explicit.

---------

Co-authored-by: Fabian Joswig <fabian.joswig@ed.ac.uk>
2023-03-15 17:46:12 +00:00

9 lines
No EOL
422 B
Python

import pyerrors as pe
def test_sort_names():
my_list = ['sfqcd_r1_id5', 'sfqcd_r10_id5', 'sfqcd_r7_id5', 'sfqcd_r2_id5', 'sfqcd_r2_id9', 'sfqcd_r10_id4']
presorted_list = ['sfqcd_r1_id5', 'sfqcd_r2_id5', 'sfqcd_r2_id9', 'sfqcd_r7_id5', 'sfqcd_r10_id4', 'sfqcd_r10_id5']
sorted_list = pe.input.utils.sort_names(my_list)
assert (all([sorted_list[i] == presorted_list[i] for i in range(len(sorted_list))]))