Skip to content

Commit b0b08d1

Browse files
committed
fix: test_parse mv to test_cli.py
1 parent a3e4db0 commit b0b08d1

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ build:
2727
file-test:
2828
uv run gendiff /home/zk/python-project-50/file1.json /home/zk/python-project-50/file2.json
2929

30-
full-check: test lint file-test test-coverage-without-xml
30+
full-check: test-coverage-without-xml file-test lint
3131

3232
.PHONY: install test lint selfcheck check build
3333

gendiff/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22

33

4-
def parse_args(args=None):
4+
def parse_args(args=None): # args need only for test
55
parser = argparse.ArgumentParser(
66
prog='gendiff',
77
description='Compares two configuration files and shows a difference.',

tests/test_cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from gendiff.cli import parse_args
2+
3+
4+
def test_parse_args_with_args():
5+
test_args = ['--format', 'test_format', 'file1.json', 'file2.json']
6+
7+
args = parse_args(test_args)
8+
9+
assert args.format == 'test_format'
10+
assert args.first_file == 'file1.json'
11+
assert args.second_file == 'file2.json'

tests/test_gendiff.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import pytest
55

6-
from gendiff.cli import parse_args
76
from gendiff.gendiff import generate_diff, read_file_json, sort_list
87

98

@@ -77,13 +76,3 @@ def test_generate_diff(temp_dir_with_files):
7776
file1_path = os.path.join(temp_dir_with_files, 'file1.json')
7877
file2_path = os.path.join(temp_dir_with_files, 'file2.json')
7978
assert generate_diff(file1_path, file2_path) == right_str
80-
81-
82-
def test_parse_args_with_args():
83-
test_args = ['--format', 'test_format', 'file1.json', 'file2.json']
84-
85-
args = parse_args(test_args)
86-
87-
assert args.format == 'test_format'
88-
assert args.first_file == 'file1.json'
89-
assert args.second_file == 'file2.json'

0 commit comments

Comments
 (0)