This repository has been archived by the owner on May 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cca1148
commit 122ff78
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
from chakra.et_visualizer import main | ||
from unittest.mock import patch | ||
|
||
# Assuming 'example_input.et' is the example input file you provided | ||
example_input_file = 'example_input.et' | ||
|
||
def test_run_with_pdf_output(): | ||
test_args = ["et_visualizer.py", "--input_filename", example_input_file, "--output_filename", "output.pdf"] | ||
with patch('sys.argv', test_args): | ||
main() # No assertion needed; we're checking if it runs without error | ||
|
||
def test_run_with_dot_output(): | ||
test_args = ["et_visualizer.py", "--input_filename", example_input_file, "--output_filename", "output.dot"] | ||
with patch('sys.argv', test_args): | ||
main() # No assertion needed; we're checking if it runs without error | ||
|
||
def test_run_with_graphml_output(): | ||
test_args = ["et_visualizer.py", "--input_filename", example_input_file, "--output_filename", "output.graphml"] | ||
with patch('sys.argv', test_args): | ||
main() # No assertion needed; we're checking if it runs without error | ||
|
||
def test_incorrect_file_path(): | ||
test_args = ["et_visualizer.py", "--input_filename", "nonexistent_input.et", "--output_filename", "output.pdf"] | ||
with patch('sys.argv', test_args): | ||
with pytest.raises(FileNotFoundError): | ||
main() | ||
|
||
def test_unsupported_file_extension(): | ||
test_args = ["et_visualizer.py", "--input_filename", example_input_file, "--output_filename", "output.xyz"] | ||
with patch('sys.argv', test_args): | ||
with pytest.raises(ValueError): | ||
main() |