Skip to content

Commit 33848e5

Browse files
committed
Changed Jinja template and regenerated tests for rotational-cipher.
1 parent 2e1453a commit 33848e5

2 files changed

Lines changed: 4 additions & 32 deletions

File tree

exercises/practice/rotational-cipher/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class {{ exercise | camel_case }}Test(unittest.TestCase):
1313
{% endfor %}
1414
{% endfor %}
1515

16-
{{ macros.footer() }}
16+
{{ macros.footer(True) }}

exercises/practice/rotational-cipher/rotational_cipher_test.py

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,10 @@
88

99

1010
class RotationalCipherTest(unittest.TestCase):
11-
def test_rotate_a_by_0_same_output_as_input(self):
12-
self.assertEqual(rotate("a", 0), "a")
1311

14-
def test_rotate_a_by_1(self):
15-
self.assertEqual(rotate("a", 1), "b")
16-
17-
def test_rotate_a_by_26_same_output_as_input(self):
18-
self.assertEqual(rotate("a", 26), "a")
19-
20-
def test_rotate_m_by_13(self):
21-
self.assertEqual(rotate("m", 13), "z")
22-
23-
def test_rotate_n_by_13_with_wrap_around_alphabet(self):
24-
self.assertEqual(rotate("n", 13), "a")
25-
26-
def test_rotate_capital_letters(self):
27-
self.assertEqual(rotate("OMG", 5), "TRL")
28-
29-
def test_rotate_spaces(self):
30-
self.assertEqual(rotate("O M G", 5), "T R L")
31-
32-
def test_rotate_numbers(self):
33-
self.assertEqual(rotate("Testing 1 2 3 testing", 4), "Xiwxmrk 1 2 3 xiwxmrk")
34-
35-
def test_rotate_punctuation(self):
36-
self.assertEqual(rotate("Let's eat, Grandma!", 21), "Gzo'n zvo, Bmviyhv!")
37-
38-
def test_rotate_all_letters(self):
39-
self.assertEqual(
40-
rotate("The quick brown fox jumps over the lazy dog.", 13),
41-
"Gur dhvpx oebja sbk whzcf bire gur ynml qbt.",
42-
)
12+
# Utility functions
13+
def assertRaisesWithMessage(self, exception):
14+
return self.assertRaisesRegex(exception, r".+")
4315

4416

4517
if __name__ == "__main__":

0 commit comments

Comments
 (0)