aboutsummaryrefslogtreecommitdiff
path: root/challenge-263/sgreen/python/test.py
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-04-07 10:35:40 +0100
committerGitHub <noreply@github.com>2024-04-07 10:35:40 +0100
commite9626071ae8fae41c7b6d868050e0b68b9d6da74 (patch)
tree78c2b4d28f963672f20ae43356ba0cee38dfb734 /challenge-263/sgreen/python/test.py
parent5a1376704f54e74f87f811c914f36aa87eb4cc77 (diff)
parente8a06518b223e93803e1dd78d2e07c92c15b8115 (diff)
downloadperlweeklychallenge-club-e9626071ae8fae41c7b6d868050e0b68b9d6da74.tar.gz
perlweeklychallenge-club-e9626071ae8fae41c7b6d868050e0b68b9d6da74.tar.bz2
perlweeklychallenge-club-e9626071ae8fae41c7b6d868050e0b68b9d6da74.zip
Merge pull request #9885 from simongreen-net/master
sgreen solutions to challenge 263
Diffstat (limited to 'challenge-263/sgreen/python/test.py')
-rwxr-xr-xchallenge-263/sgreen/python/test.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-263/sgreen/python/test.py b/challenge-263/sgreen/python/test.py
new file mode 100755
index 0000000000..46adb6e558
--- /dev/null
+++ b/challenge-263/sgreen/python/test.py
@@ -0,0 +1,30 @@
+#!/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.target_index([1, 5, 3, 2, 4, 2], 2), [1, 2])
+ self.assertEqual(ch_1.target_index([1, 2, 4, 3, 5], 6), [])
+ self.assertEqual(ch_1.target_index([5, 3, 2, 4, 2, 1], 4), [4])
+
+ def test_ch_2(self):
+ self.assertEqual(
+ ch_2.merge_items([[1, 1], [2, 1], [3, 2]], [[2, 2], [1, 3]]),
+ [[1, 4], [2, 3], [3, 2]]
+ )
+ self.assertEqual(
+ ch_2.merge_items([[1, 2], [2, 3], [1, 3], [3, 2]], [[3, 1], [1, 3]]),
+ [[1, 8], [2, 3], [3, 3]]
+ )
+ self.assertEqual(
+ ch_2.merge_items([[1, 1], [2, 2], [3, 3]], [[2, 3], [2, 4]]),
+ [[1, 1], [2, 9], [3, 3]]
+ )
+
+
+if __name__ == '__main__':
+ unittest.main()