aboutsummaryrefslogtreecommitdiff
path: root/challenge-275/sgreen/python/test.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-06-30 13:50:07 +0100
committerGitHub <noreply@github.com>2024-06-30 13:50:07 +0100
commit7edec2d1810751b703297f27426a9629eb3076d0 (patch)
tree24faf33fbb55c59fa74b9d5a88656dc8c03374fe /challenge-275/sgreen/python/test.py
parent6f401642435ccfb226356a1079f44ccdfc7cc00a (diff)
parentb7df036a3f3988e2ae38af4f43b8d53f4cf5e0f3 (diff)
downloadperlweeklychallenge-club-7edec2d1810751b703297f27426a9629eb3076d0.tar.gz
perlweeklychallenge-club-7edec2d1810751b703297f27426a9629eb3076d0.tar.bz2
perlweeklychallenge-club-7edec2d1810751b703297f27426a9629eb3076d0.zip
Merge pull request #10341 from simongreen-net/master
sgreen solutions to challenge 275
Diffstat (limited to 'challenge-275/sgreen/python/test.py')
-rwxr-xr-xchallenge-275/sgreen/python/test.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-275/sgreen/python/test.py b/challenge-275/sgreen/python/test.py
new file mode 100755
index 0000000000..96f643528f
--- /dev/null
+++ b/challenge-275/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.broken_keys('Perl Weekly Challenge', ['l', 'a']), 0)
+ self.assertEqual(ch_1.broken_keys('Perl and Raku', ['a']), 1)
+ self.assertEqual(ch_1.broken_keys('Well done Team PWC', ['l', 'o']), 2)
+ self.assertEqual(ch_1.broken_keys('The joys of polyglottism', ['T']), 2)
+
+ def test_ch_2(self):
+ self.assertEqual(ch_2.replace_digits('a1c1e1'), 'abcdef')
+ self.assertEqual(ch_2.replace_digits('a1b2c3d4'), 'abbdcfdh')
+ self.assertEqual(ch_2.replace_digits('b2b'), 'bdb')
+ self.assertEqual(ch_2.replace_digits('a16z'), 'abgz')
+
+
+if __name__ == '__main__':
+ unittest.main()