From d92a17b531ba076b90ff9354537b34476e317a32 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Sun, 25 Oct 2020 18:48:19 +1100 Subject: [PATCH] This is why you test :D --- ih/cli.py | 2 +- ih/palette.py | 2 +- tests/test_cli.py | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ih/cli.py b/ih/cli.py index 79467ff..908af60 100644 --- a/ih/cli.py +++ b/ih/cli.py @@ -10,7 +10,7 @@ "-p", default=chart.DEFAULT["palette"], show_default=True, - type=click.Choice(palette.PALETTES), + type=click.Choice(palette.PALETTES + list(palette.PALETTE_OVERRIDE.keys())), help="Palette to use. See README.md for provenance", ) @click.option( diff --git a/ih/palette.py b/ih/palette.py index 6ab3da2..d680881 100644 --- a/ih/palette.py +++ b/ih/palette.py @@ -54,7 +54,7 @@ def get_thread_image(palette_name): def get_palette(palette_name): if palette_name in PALETTE_OVERRIDE.keys(): - palette = PALETTE_OVERRIDE[palette_name] + palette_name = PALETTE_OVERRIDE[palette_name] if palette_name not in PALETTES: raise ValueError( diff --git a/tests/test_cli.py b/tests/test_cli.py index 84e403c..523b899 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -10,7 +10,7 @@ def runner(args, output=TEST_HTML, print_output=False): runner = CliRunner() result = runner.invoke(main, [TEST_IMAGE] + args) - if print_output: + if print_output: print(result.output) assert result.exit_code == 0 assert output in result.output @@ -33,8 +33,21 @@ def test_guidelines(): runner(["-g"]) +def test_thread(): + runner(["-p", "🧵"]) + + +def test_alpaca(): + runner(["-p", "🦙"]) + + +def test_wool(): + runner(["-p", "🧶"]) + + def test_term(): runner(["-o", "term"], output="ih version") + def test_term_render(): runner(["-o", "term", "-r"], output="ih version", print_output=True)