Total Complexity | 4 |
Total Lines | 12 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from hamcrest.library.text.substringmatcher import SubstringMatcher |
||
9 | class StringContains(SubstringMatcher): |
||
10 | |||
11 | def __init__(self, substring): |
||
12 | super(StringContains, self).__init__(substring) |
||
13 | |||
14 | def _matches(self, item): |
||
15 | if not hasmethod(item, 'find'): |
||
16 | return False |
||
17 | return item.find(self.substring) >= 0 |
||
18 | |||
19 | def relationship(self): |
||
20 | return 'containing' |
||
21 | |||
39 |