Skip to content

Commit 2665bd5

Browse files
committed
Rebasing
1 parent d1129d7 commit 2665bd5

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

tests/test_morphio.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,78 @@ def test_grid_selection(self, setup, tmp_path):
329329
expected = filter(ignore_path, tf)
330330
are_files_same(actual, expected)
331331

332+
def test_grid_selection(self, setup, tmp_path):
333+
morph_file = self.testfiles[0]
334+
335+
# Save on default grid
336+
tmp_default = tmp_path.joinpath("default")
337+
tmp_default_name = tmp_default.resolve().as_posix()
338+
339+
opts, pargs = self.parser.parse_args(
340+
[
341+
"--multiple-morphs",
342+
"-s",
343+
tmp_default_name,
344+
"-n",
345+
"--save-names-file",
346+
tssf,
347+
"--xmax",
348+
"35",
349+
]
350+
)
351+
352+
pargs = [testsequence_dir, morph_file]
353+
multiple_morphs(self.parser, opts, pargs, stdout_flag=False)
354+
355+
tmp_default_morphs = tmp_default.joinpath("Morphs")
356+
357+
# Check the saved files are the same for verbose
358+
common = []
359+
for item in tmp_default_morphs.glob("**/*.*"):
360+
if item.is_file():
361+
common.append(item.relative_to(tmp_default_morphs).as_posix())
362+
for file in common:
363+
with open(tmp_default_morphs.joinpath(file)) as gf:
364+
with open(test_saving_grid_default.joinpath(file)) as tf:
365+
actual = filter(ignore_path, gf)
366+
expected = filter(ignore_path, tf)
367+
are_files_same(actual, expected)
368+
369+
# Save on original grid
370+
tmp_original = tmp_path.joinpath("original")
371+
tmp_original_name = tmp_original.resolve().as_posix()
372+
373+
opts, pargs = self.parser.parse_args(
374+
[
375+
"--multiple-morphs",
376+
"-s",
377+
tmp_original_name,
378+
"-n",
379+
"--save-names-file",
380+
tssf,
381+
"--xmax",
382+
"35",
383+
"-o",
384+
]
385+
)
386+
387+
pargs = [testsequence_dir, morph_file]
388+
multiple_morphs(self.parser, opts, pargs, stdout_flag=False)
389+
390+
tmp_original_morphs = tmp_default.joinpath("Morphs")
391+
392+
# Check the saved files are the same for verbose
393+
common = []
394+
for item in tmp_original_morphs.glob("**/*.*"):
395+
if item.is_file():
396+
common.append(item.relative_to(tmp_original_morphs).as_posix())
397+
for file in common:
398+
with open(tmp_original_morphs.joinpath(file)) as gf:
399+
with open(test_saving_grid_original.joinpath(file)) as tf:
400+
actual = filter(ignore_path, gf)
401+
expected = filter(ignore_path, tf)
402+
are_files_same(actual, expected)
403+
332404
# Similar format as test_morph_outputs
333405
def test_morph_diff_outputs(self, setup, tmp_path):
334406
morph_file = self.testfiles[0]

0 commit comments

Comments
 (0)