Skip to content

Commit c29e15f

Browse files
committed
Streamline file.
1 parent ee4df72 commit c29e15f

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

cubids/tests/test_cli.py

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
"""
2-
This file contains unit tests for the command-line interface (CLI) of the CuBIDS package.
1+
"""Unit tests for the command-line interface (CLI) of the CuBIDS package.
32
43
The tests cover the following functions:
54
- _path_exists: Tests whether a given path exists or not.
65
- _is_file: Tests whether a given path is a file or a directory.
7-
- _get_parser: Tests the creation and configuration of the argument parser.
8-
- _main: Tests the main function of the CLI.
96
107
Each test case includes assertions to verify the expected behavior of the corresponding function.
11-
12-
Author: [Your Name]
13-
Date: [Current Date]
148
"""
159

1610
import argparse
1711
from functools import partial
1812

1913
import pytest
2014

21-
from cubids.cli import _get_parser, _is_file, _main, _path_exists
15+
from cubids.cli import _is_file, _path_exists
2216
from cubids.tests.utils import chdir
2317

2418

@@ -106,38 +100,3 @@ def test_is_file(tmp_path):
106100
# Test with a non-existing path within an argument parser
107101
with pytest.raises(SystemExit):
108102
parser.parse_args([str(non_existing_path)])
109-
110-
111-
def _test_get_parser():
112-
"""Test the creation and configuration of the argument parser.
113-
114-
This function tests the `_get_parser` function by asserting that the returned object is an
115-
instance of `argparse.ArgumentParser`, and that it has the expected `prog` and `description`
116-
attributes.
117-
Additional assertions can be added to test the configuration of the parser.
118-
"""
119-
parser = _get_parser()
120-
assert isinstance(parser, argparse.ArgumentParser)
121-
assert parser.prog == "cubids"
122-
assert parser.description == "Console script for cubids"
123-
# Add more assertions for the parser configuration
124-
125-
126-
def _test_main():
127-
"""Test the main function of the CLI.
128-
129-
This function tests the `_main` function by providing different sets of arguments.
130-
It asserts that the function returns the expected exit code (0 or 1) based on the provided
131-
arguments.
132-
"""
133-
# Test the main function with valid arguments
134-
argv = ["validate", "/path/to/dataset"]
135-
assert _main(argv) == 0
136-
137-
# Test the main function with invalid arguments
138-
argv = ["invalid-command", "/path/to/dataset"]
139-
assert _main(argv) == 1
140-
141-
# Test the main function with missing arguments
142-
argv = []
143-
assert _main(argv) == 1

0 commit comments

Comments
 (0)