From 40c5fa7a0c13f894444e846f81e9a846b890c236 Mon Sep 17 00:00:00 2001 From: Matheus Felipe <50463866+matheusfelipeog@users.noreply.github.com> Date: Mon, 17 Jan 2022 02:13:34 -0300 Subject: [PATCH] Test error message return and return type --- scripts/tests/test_validate_format.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/tests/test_validate_format.py b/scripts/tests/test_validate_format.py index a66f703c..824e426f 100644 --- a/scripts/tests/test_validate_format.py +++ b/scripts/tests/test_validate_format.py @@ -1,7 +1,32 @@ # -*- coding: utf-8 -*- +from email import message import unittest +from validate.format import error_message + class TestValidadeFormat(unittest.TestCase): - ... + + def test_error_message_return_and_return_type(self): + line_num_unity = 1 + line_num_ten = 10 + line_num_hundred = 100 + line_num_thousand = 1000 + + msg = 'This is a unit test' + + err_msg_unity = error_message(line_num_unity, msg) + err_msg_ten = error_message(line_num_ten, msg) + err_msg_hundred = error_message(line_num_hundred, msg) + err_msg_thousand = error_message(line_num_thousand, msg) + + self.assertIsInstance(err_msg_unity, str) + self.assertIsInstance(err_msg_ten, str) + self.assertIsInstance(err_msg_hundred, str) + self.assertIsInstance(err_msg_thousand, str) + + self.assertEqual(err_msg_unity, '(L002) This is a unit test') + self.assertEqual(err_msg_ten, '(L011) This is a unit test') + self.assertEqual(err_msg_hundred, '(L101) This is a unit test') + self.assertEqual(err_msg_thousand, '(L1001) This is a unit test')