def test_search_unique(self):
     test_dir = self.get_test_loc('finder/search', copy=True)
     pattern = 'Copyright'
     tests = [
         (u'addr.c', [u'Copyright']),
         (u'CommandLine.java', [u'Copyright']),
         (u'CustomFileFilter.java', [u'Copyright', ]),
         (u'diskio.c', [u'copyright', u'Copyright']),
         (u'getopt_long.c', [u'Copyright']),
     ]
     for test_file, expected in tests:
         location = os.path.join(test_dir, test_file)
         result = list(s for s, _ln in finder.find_pattern(location, pattern, unique=True))
         assert expected == result
 def test_search_unique(self):
     test_dir = self.get_test_loc('finder/search', copy=True)
     pattern = 'Copyright'
     tests = [
         (u'addr.c', [u'Copyright']),
         (u'CommandLine.java', [u'Copyright']),
         (u'CustomFileFilter.java', [u'Copyright', ]),
         (u'diskio.c', [u'copyright', u'Copyright']),
         (u'getopt_long.c', [u'Copyright']),
     ]
     for test_file, expected in tests:
         location = os.path.join(test_dir, test_file)
         result = list(s for s, _ln in finder.find_pattern(location, pattern, unique=True))
         assert expected == result
 def test_search_in_binaries_with_line(self):
     test_file = self.get_test_loc('finder/binaries/gapi32.dll')
     pattern = r'This program ([\(\w\)\.\- ]+)'
     expected = [('cannot be run in DOS mode.', 1)]
     result = list(finder.find_pattern(test_file, pattern))
     assert expected == result
 def test_search_in_binaries_with_line(self):
     test_file = self.get_test_loc('finder/binaries/gapi32.dll')
     pattern = r'This program ([\(\w\)\.\- ]+)'
     expected = [('cannot be run in DOS mode.', 1)]
     result = list(finder.find_pattern(test_file, pattern))
     assert expected == result