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