[M] Change in pysim[master]: tests_files.py: Reduce code duplication