Skip to content

Commit 45be59e

Browse files
GascaKcmccandless
authored andcommitted
acronym: update tests to v1.6.0 (exercism#1596)
Updated test case for apostrophes in [canonical data](https://github.com/exercism/problem-specifications/blob/master/exercises/acronym/canonical-data.json) and updated example.py to correctly solve the new apostrophe test case.
1 parent e3753ac commit 45be59e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

exercises/acronym/acronym_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from acronym import abbreviate
44

55

6-
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.5.0
6+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.6.0
77

88
class AcronymTest(unittest.TestCase):
99
def test_basic(self):
@@ -31,6 +31,9 @@ def test_consecutive_delimiters(self):
3131
self.assertEqual(
3232
abbreviate('Something - I made up from thin air'), 'SIMUFTA')
3333

34+
def test_apostrophes(self):
35+
self.assertEqual(abbreviate("Halley's Comet"), 'HC')
36+
3437

3538
if __name__ == '__main__':
3639
unittest.main()

exercises/acronym/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
def abbreviate(words):
5-
regex = '[A-Z]+[a-z]*|[a-z]+'
5+
regex = "[A-Z]+['a-z]*|['a-z]+"
66
return ''.join(word[0].upper() for word in re.findall(regex, words))

0 commit comments

Comments
 (0)