aboutsummaryrefslogtreecommitdiff
path: root/challenge-331/sgreen/python/test.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-07-22 12:52:51 +0100
committerGitHub <noreply@github.com>2025-07-22 12:52:51 +0100
commit95ff536e894a177444ac5cac0da499c9951f443f (patch)
tree3ed0452da08231834d216cbf94f78a7445631e31 /challenge-331/sgreen/python/test.py
parentb335afba876ef25a29b33491c40bb799259b739f (diff)
parenta1e3158274222306a52771654c65396d9cfc4788 (diff)
downloadperlweeklychallenge-club-95ff536e894a177444ac5cac0da499c9951f443f.tar.gz
perlweeklychallenge-club-95ff536e894a177444ac5cac0da499c9951f443f.tar.bz2
perlweeklychallenge-club-95ff536e894a177444ac5cac0da499c9951f443f.zip
Merge pull request #12397 from simongreen-net/master
sgreen solutions to challenge 331
Diffstat (limited to 'challenge-331/sgreen/python/test.py')
-rwxr-xr-xchallenge-331/sgreen/python/test.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-331/sgreen/python/test.py b/challenge-331/sgreen/python/test.py
new file mode 100755
index 0000000000..636ba07a77
--- /dev/null
+++ b/challenge-331/sgreen/python/test.py
@@ -0,0 +1,23 @@
+#!/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.last_word("The Weekly Challenge"), 9)
+ self.assertEqual(ch_1.last_word("The Weekly Challenge!"), 9)
+ self.assertEqual(ch_1.last_word(" Hello World "), 5)
+ self.assertEqual(ch_1.last_word("Let's"), 5)
+ self.assertEqual(ch_1.last_word("!!!"), 0)
+
+ def test_ch_2(self):
+ self.assertTrue(ch_2.buddy_strings("nice", "ncie"))
+ self.assertFalse(ch_2.buddy_strings("love", "love"))
+ self.assertTrue(ch_2.buddy_strings("feed", "feed"))
+
+
+if __name__ == '__main__':
+ unittest.main()