1
+ # https://en.wikipedia.org/wiki/Anagram
2
+ # Anagrams may be created as a commentary on the subject.
3
+ # They may be a synonym or antonym of their subject,
4
+ # a parody, a criticism or satire.
5
+ import pytest
6
+
7
+ from anagram import is_anagram
8
+
9
+
10
+ @pytest .mark .parametrize ("word1, word2" , [
11
+ ("rail safety" , "fairy tales" ),
12
+ ("roast beef" , "eat for BSE" ),
13
+ # An anagram which means the opposite of its subject is
14
+ # called an "antigram". For example:
15
+ ("restful" , "fluster" ),
16
+ ("funeral" , "real fun" ),
17
+ ("adultery" , "true lady" ),
18
+ ("customers" , "store scum" ),
19
+ ("forty five" , "over fifty" ),
20
+ # They can sometimes change from a proper noun or personal
21
+ # name into an appropriate sentence:
22
+ ("William Shakespeare" , "I am a weakish speller" ),
23
+ ("Madam Curie" , "Radium came" ),
24
+ ])
25
+ def test_is_anagram (word1 , word2 ):
26
+ assert is_anagram (word1 , word2 )
27
+
28
+
29
+ @pytest .mark .parametrize ("word1, word2" , [
30
+ ("rail safety" , "fairy fun" ),
31
+ ("roast beef" , "eat for ME" ),
32
+ ("restful" , "fluester" ),
33
+ ("funeral" , "real funny" ),
34
+ ("adultery" , "true ladie" ),
35
+ ("customers" , "store scam" ),
36
+ ("forty five" , "over fifty1" ),
37
+ ("William Shakespeare" , "I am a strong speller" ),
38
+ ("Madam Curie" , "Radium come" ),
39
+ ])
40
+ def test_is_not_anagram (word1 , word2 ):
41
+ assert not is_anagram (word1 , word2 )
0 commit comments