From 54fd1456aedcb3ffb6a1a67e608fd7f4b6285ed2 Mon Sep 17 00:00:00 2001 From: Akshay Nagpal Date: Sat, 7 May 2016 20:52:23 +0530 Subject: [PATCH] version 0.2 commit --- setup.py | 4 ++-- unit_testing.py | 18 ++++++++++++++++++ word2number/unit_testing.py | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 unit_testing.py create mode 100644 word2number/unit_testing.py diff --git a/setup.py b/setup.py index befa4e8..e864293 100644 --- a/setup.py +++ b/setup.py @@ -12,13 +12,13 @@ def open_file(fname): setup( name = 'word2number', packages = ['word2number'], # this must be the same as the name above - version = '0.1', + version = '0.2', license=open('LICENSE.txt').read(), description = 'Convert number words(eg. three hundred and forty two) to numbers(342).', author = 'Akshay Nagpal', author_email = 'akshay2626@gmail.com', url = 'https://github.com/akshaynagpal/w2n', # use the URL to the github repo - download_url = 'https://github.com/akshaynagpal/w2n/tarball/0.1', # I'll explain this in a second + download_url = 'https://github.com/akshaynagpal/w2n/tarball/0.2', # I'll explain this in a second keywords = ['numbers', 'convert', 'words'], # arbitrary keywords classifiers = [ 'Intended Audience :: Developers', diff --git a/unit_testing.py b/unit_testing.py new file mode 100644 index 0000000..bf2b839 --- /dev/null +++ b/unit_testing.py @@ -0,0 +1,18 @@ +import unittest +import w2n + +class TestW2N(unittest.TestCase): + + def test_output(self): + self.assertEqual(w2n.word_to_num("two million three thousand nine hundred and eighty four"),2003984) + self.assertEqual(w2n.word_to_num("nineteen"),19) + self.assertEqual(w2n.word_to_num('three billion'),3000000000) + self.assertEqual(w2n.word_to_num('three million'),3000000) + self.assertEqual(w2n.word_to_num('one hundred twenty three million four hundred fifty six thousand seven hundred and eighty nine') +,123456789) + self.assertEqual(w2n.word_to_num('eleven'),11) + self.assertEqual(w2n.word_to_num('nineteen billion and nineteen'),19000000019) + self.assertEqual(w2n.word_to_num('one hundred and forty two'),142) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/word2number/unit_testing.py b/word2number/unit_testing.py new file mode 100644 index 0000000..68949db --- /dev/null +++ b/word2number/unit_testing.py @@ -0,0 +1,18 @@ +import unittest +from word2number import w2n + +class TestW2N(unittest.TestCase): + + def test_output(self): + self.assertEqual(w2n.word_to_num("two million three thousand nine hundred and eighty four"),2003984) + self.assertEqual(w2n.word_to_num("nineteen"),19) + self.assertEqual(w2n.word_to_num('three billion'),3000000000) + self.assertEqual(w2n.word_to_num('three million'),3000000) + self.assertEqual(w2n.word_to_num('one hundred twenty three million four hundred fifty six thousand seven hundred and eighty nine') +,123456789) + self.assertEqual(w2n.word_to_num('eleven'),11) + self.assertEqual(w2n.word_to_num('nineteen billion and nineteen'),19000000019) + self.assertEqual(w2n.word_to_num('one hundred and forty two'),142) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file