aboutsummaryrefslogtreecommitdiff
path: root/challenge-321/sgreen/python/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-321/sgreen/python/test.py')
-rwxr-xr-xchallenge-321/sgreen/python/test.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-321/sgreen/python/test.py b/challenge-321/sgreen/python/test.py
new file mode 100755
index 0000000000..2c353d53a2
--- /dev/null
+++ b/challenge-321/sgreen/python/test.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import unittest
+ch_1 = __import__("ch-1")
+ch_2 = __import__("ch-2")
+
+
+class TestClass(unittest.TestCase):
+ def test_ch_1(self):
+ self.assertEqual(ch_1.distinct_average([1, 2, 4, 3, 5, 6]), 1)
+ self.assertEqual(ch_1.distinct_average([0, 2, 4, 8, 3, 5]), 2)
+ self.assertEqual(ch_1.distinct_average([7, 3, 1, 0, 5, 9]), 2)
+
+ def test_ch_2(self):
+ self.assertTrue(ch_2.backspace_compare("ab#c", "ad#c"))
+ self.assertTrue(ch_2.backspace_compare("ab##", "a#b#"))
+ self.assertFalse(ch_2.backspace_compare("a#b", "c"))
+
+
+if __name__ == "__main__":
+ unittest.main()