From fe56f73813f1634f3cc9b4c7f8ae85decbfeb557 Mon Sep 17 00:00:00 2001 From: "Jacob L. Steenwyk" Date: Tue, 26 Jul 2022 14:26:14 -0500 Subject: [PATCH] updated argparsing test for when fasta file is in cwd and args.output_path is set to None --- orthosnap/args_processing.py | 2 +- tests/unit/test_args_parsing.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/orthosnap/args_processing.py b/orthosnap/args_processing.py index a6d2bdd0..d888b448 100644 --- a/orthosnap/args_processing.py +++ b/orthosnap/args_processing.py @@ -53,7 +53,7 @@ def process_args(args) -> dict: output_path = output_path + "/" else: output_path = re.sub("/[^/]+$", '', fasta) - if not output_path: + if output_path == fasta: output_path = "./" elif not output_path.endswith("/"): output_path = output_path + "/" diff --git a/tests/unit/test_args_parsing.py b/tests/unit/test_args_parsing.py index 56d2565a..7e5002e7 100644 --- a/tests/unit/test_args_parsing.py +++ b/tests/unit/test_args_parsing.py @@ -123,3 +123,9 @@ def test_output_path_no_slash(self, args): args.output_path = "./tests/samples" res = process_args(args) assert res["output_path"] == "./tests/samples/" + + def test_output_path_none(self, args): + args.fasta = "requirements.txt" # fake stand in file + args.output_path = None + res = process_args(args) + assert res["output_path"] == "./"