From acf45ea4efe713f733aa3ab787703cbcb6d35ce2 Mon Sep 17 00:00:00 2001 From: AmAnAgr Date: Thu, 1 Feb 2018 19:21:54 +0530 Subject: [PATCH] converter: Get test coverage to 100% Fixes #122 --- .../zulip_bots/bots/converter/test_converter.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zulip_bots/zulip_bots/bots/converter/test_converter.py b/zulip_bots/zulip_bots/bots/converter/test_converter.py index c609c18..5328b9d 100755 --- a/zulip_bots/zulip_bots/bots/converter/test_converter.py +++ b/zulip_bots/zulip_bots/bots/converter/test_converter.py @@ -1,5 +1,7 @@ from zulip_bots.test_lib import BotTestCase +from zulip_bots.bots.converter import utils + class TestConverterBot(BotTestCase): bot_name = "converter" @@ -13,5 +15,17 @@ class TestConverterBot(BotTestCase): ("12.0 celsius fahrenheit", "12.0 celsius = 53.600054 fahrenheit\n"), ("0.002 kilometer millimile", "0.002 kilometer = 1.2427424 millimile\n"), ("3 megabyte kilobit", "3 megabyte = 24576.0 kilobit\n"), + ("foo m cm", "`foo` is not a valid number. " + utils.QUICK_HELP + "\n"), + ("@convert help", "1. conversion: Too few arguments given. " + "Enter `@convert help` for help on using the converter.\n" + "2. conversion: " + utils.HELP_MESSAGE + "\n"), + ("2 celsius kilometer", "`Meter` and `Celsius` are not from the same category. " + "Enter `@convert help` for help on using the converter.\n"), + ("2 foo kilometer", "`foo` is not a valid unit." + " Enter `@convert help` for help on using the converter.\n"), + ("2 kilometer foo", "`foo` is not a valid unit." + "Enter `@convert help` for help on using the converter.\n"), + + ] self.verify_dialog(dialog)