Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing functions #3

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,37 @@ def test_main(tmp_path: Path):
expected_output_file = outputdir / 'plaintext.count.txt'
assert expected_output_file.exists()
assert expected_output_file.read_text() == '2'

def test_expected_date_format():
#tests a standard input
result = dateTreeBuild('20200101', '20200105', 'test_dir5')
expected = "File successfully created"
assert result == expected, f"Expected '{expected}', but got '{result}'"


def test_alternative_date_format():
#tests if the user entered date in different styles
result = dateTreeBuild('2021-01-01', '20210105', 'test_dir6')
expected = "File successfully created"
assert result == expected, f"Expected '{expected}', but got '{result}'"

def test_non_existent_dates():
#tests if the user entered date that does not exist
result = dateTreeBuild('20211312', '20211232', 'test_dir7')
expected = "Error: Either the start or end dates do not exist"
assert result == expected, f"Expected '{expected}', but got '{result}'"

def test_start_after_end_dates():
#tests if the user entered date that does not exist
result = dateTreeBuild('20211204', '20211201', 'test_dir8')
expected = "Error: The end date is before the start date."
assert result == expected, f"Expected '{expected}', but got '{result}'"


def test_successful_file_creation():
result = dateTreeBuild('20220101', '20220105', 'test_dir9')
expected = "File successfully created"
assert result == expected, f"Expected '{expected}', but got '{result}'"



Loading