Impr/refactor find files (#153)

* wrote small test for ms5_xsf read method

* small bug in ms5_xsf found

* first version of refactoring with test

* built _find_files into openQCD module

* postfix can now be used as before

* altered test data to be smaller

* read_rwms throws better Exception now

* typo corrected

* better tests for postfixes, also added similar solution for ext variable

* added method to sort names of files and replica better
This commit is contained in:
Justus Kuhlmann 2023-02-17 12:51:00 +01:00 committed by GitHub
parent ee74ec4ed7
commit 0bc08be634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 2 deletions

View file

@ -165,3 +165,11 @@ def test_find_files():
fpre = "tune62"
with pytest.raises(Exception):
pe.input.openQCD._find_files(path, fpre, "ms5_xsf_" + qc, "dat")
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.openQCD._sort_names(my_list)
assert (all([sorted_list[i] == presorted_list[i] for i in range(len(sorted_list))]))