From 1f36329cbdb66d941c7107a39769d5c659e44727 Mon Sep 17 00:00:00 2001 From: Akshay Nagpal Date: Fri, 2 Jun 2017 09:43:27 -0400 Subject: [PATCH] minor fix in unittesting to increase coverage --- unit_testing.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/unit_testing.py b/unit_testing.py index dc08f7d..9536d85 100644 --- a/unit_testing.py +++ b/unit_testing.py @@ -31,18 +31,18 @@ def test_positives(self): self.assertEqual(w2n.word_to_num('million'), 1000000) self.assertEqual(w2n.word_to_num('billion'), 1000000000) self.assertEqual(w2n.word_to_num('nine point nine nine nine'), 9.999) + self.assertEqual(w2n.word_to_num('seventh point nineteen'), 0) def test_negatives(self): - with self.assertRaises(ValueError): - w2n.word_to_num('112-') - w2n.word_to_num('-') - w2n.word_to_num('on') - w2n.word_to_num('million million') - w2n.word_to_num('three million million') - w2n.word_to_num('million four million') - w2n.word_to_num('thousand million') - w2n.word_to_num('one billion point two million twenty three thousand and forty nine point two three six nine') - w2n.word_to_num('seventh point nineteen') - w2n.word_to_num(112) + self.assertRaises(ValueError, w2n.word_to_num, '112-') + self.assertRaises(ValueError, w2n.word_to_num, '-') + self.assertRaises(ValueError, w2n.word_to_num, 'on') + self.assertRaises(ValueError, w2n.word_to_num, 'million million') + self.assertRaises(ValueError, w2n.word_to_num, 'three million million') + self.assertRaises(ValueError, w2n.word_to_num, 'million four million') + self.assertRaises(ValueError, w2n.word_to_num, 'thousand million') + self.assertRaises(ValueError, w2n.word_to_num, 'one billion point two million twenty three thousand and forty nine point two three six nine') + self.assertRaises(ValueError, w2n.word_to_num, 112) + if __name__ == '__main__': unittest.main()