@@ -60,10 +60,16 @@ def test_nn_value(self, setup):
6060 pytest .approx (tools .nn_value (- value , name = None ), abs (- value ))
6161
6262 def test_field_sort (self , setup ):
63- sequence_files = [* os .listdir (testsequence_dir )]
63+ sequence_files = [file for file in Path (testsequence_dir ).iterdir ()]
64+ to_remove = []
65+ for file in sequence_files :
66+ if file .is_dir ():
67+ to_remove .append (file )
68+ for d in to_remove :
69+ sequence_files .remove (d )
6470 absolute_sf = []
6571 for file in sequence_files :
66- absolute_sf .append (os . path . join (testsequence_dir , file ) )
72+ absolute_sf .append (Path (testsequence_dir ) / file . name )
6773
6874 # Fisher-Yates randomization
6975 import random
@@ -84,8 +90,8 @@ def test_field_sort(self, setup):
8490 sorted_sequence .append (path .name )
8591
8692 # Temperature sort should produce same result as alphanumerical if leading character is removed
87- sequence_files .sort (key = lambda entry : entry [2 :])
88- assert sequence_files == sorted_sequence
93+ sequence_files .sort (key = lambda entry : entry . name [2 :])
94+ assert [ file . name for file in sequence_files ] == sorted_sequence
8995
9096 # Check temperatures are correct
9197 assert fvs == [174 , 180 , 186 , 192 , 198 , 204 , 210 ]
@@ -98,15 +104,15 @@ def test_field_sort(self, setup):
98104
99105 # Reversed sort should match alphanumerical sort
100106 sequence_files .sort ()
101- assert sequence_files == reversed_sequence
107+ assert [ file . name for file in sequence_files ] == reversed_sequence
102108
103109 # Check we get the same sequence when we load header information from a serial file
104110 serial_file = os .path .join (testdata_dir , "testsequence_serialfile.json" )
105111 metadata_path_sequence = tools .field_sort (path_sequence , "temperature" , serfile = serial_file , reverse = True )
106112 metadata_sequence = []
107113 for path in metadata_path_sequence :
108114 metadata_sequence .append (path .name )
109- assert sequence_files == metadata_sequence
115+ assert [ file . name for file in sequence_files ] == metadata_sequence
110116
111117 # Check error thrown when field does not exist
112118 with pytest .raises (KeyError ):
0 commit comments