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

test main #127

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pyfeyn2/mkfeyndiag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def renderer_from_string(s):
return class_for_name(".".join(s.split(".")[0:-1]), s.split(".")[-1])


def main():
def main(argv=None):
# parse command line options with argparse
parser = argparse.ArgumentParser(
prog="pyfeyn2.mkfeyndiag",
Expand Down Expand Up @@ -72,7 +72,7 @@ def main():
help="Diagram id to render.",
)

args = parser.parse_args()
args = parser.parse_args(argv)

arenderer = args.renderer
renderer = None
Expand Down
11 changes: 11 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pyfeyn2.mkfeyndiag import main


def test_main_help(capsys):
main(["--help"])
captured = capsys.readouterr()
assert "Draw FeynML diagrams with pyfeyn2." in captured.out


def test_main_tikz(capsys):
main(["tests/test.fml", "-r", "tikz"])
Loading