From 2944c9c1e2679d0eb8a8b70cda7159f9ce98bec7 Mon Sep 17 00:00:00 2001 From: Nate Carlson <ncarlson29@yahoo.com> Date: Mon, 20 Feb 2017 15:14:29 -0600 Subject: [PATCH] Unit --- test_average_file.py | 8 ++++++++ test_find.py | 12 ++++++++++++ test_highest_lowest.py | 8 ++++++++ 3 files changed, 28 insertions(+) create mode 100644 test_average_file.py create mode 100644 test_find.py create mode 100644 test_highest_lowest.py diff --git a/test_average_file.py b/test_average_file.py new file mode 100644 index 0000000..5ceadf8 --- /dev/null +++ b/test_average_file.py @@ -0,0 +1,8 @@ +from unittest import TestCase +from sentiment import * + +class TestAverage_file(TestCase): + def test_average_file(self): + x = average_file() + print('example.txt') + self.assertEquals(x, 'The average score of words in examples.txt is 1.78747550712. The overrall sentiment of examples.txt is Negative') diff --git a/test_find.py b/test_find.py new file mode 100644 index 0000000..14bfb4e --- /dev/null +++ b/test_find.py @@ -0,0 +1,12 @@ +from unittest import TestCase +from sentiment import * + + +class TestFind(TestCase): + def test_find01(self): + x = find('arty') + self.assertEquals(x, 1.25) + + def test_find02(self): + x = find('scramble') + self.assertEquals(x, 0) diff --git a/test_highest_lowest.py b/test_highest_lowest.py new file mode 100644 index 0000000..c5dff12 --- /dev/null +++ b/test_highest_lowest.py @@ -0,0 +1,8 @@ +from unittest import TestCase +from sentiment import * + +class TestHighest_lowest(TestCase): + def test_highest_lowest(self): + x = highest_lowest() + print('examples.txt') + self.assertEquals(x, 'The most positive word is "and" with a score of 2.26130653266. \nThe most negative word is "bad" with a score of 0.885135135135.') -- GitLab