1
+ from duplicates import get_duplicate_indices
2
+
3
+
4
+ def test_get_duplicate_indices_docstring ():
5
+ words = ['is' , 'it' , 'true' , 'or' , 'is' , 'it' , 'not' ]
6
+ assert get_duplicate_indices (words ) == [0 , 1 ]
7
+
8
+
9
+ def test_get_duplicate_indices_bite_text ():
10
+ words = ['this' , 'is' , 'a' , 'new' , 'bite' , 'I' , 'hope' , 'this' ,
11
+ 'bite' , 'will' , 'teach' , 'you' , 'something' , 'new' ]
12
+ assert get_duplicate_indices (words ) == [0 , 3 , 4 ]
13
+
14
+
15
+ def test_get_duplicate_indices_another_text ():
16
+ # keeping it simple with split on space, so lists != lists.
17
+ words = ('List comprehensions provide a concise way to create '
18
+ 'lists. Common applications are to make new lists where '
19
+ 'each element is the result of some operations applied '
20
+ 'to each member of another sequence or iterable, or to '
21
+ 'create a subsequence of those elements that satisfy a '
22
+ 'certain condition' ).split ()
23
+ assert get_duplicate_indices (words ) == [3 , 6 , 7 , 17 , 22 , 32 ]
0 commit comments