Skip to content

Commit

Permalink
Increase line length pep8 value
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikP committed Aug 27, 2018
1 parent baf77f6 commit 2ef8011
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/ahocorapy_test.py
Expand Up @@ -294,6 +294,37 @@ def test_pickling_simple(self):
self.assertEqual(('frodo', 20), next(results))
self.assertEqual(('gandalf', 31), next(results))

def test_pickling_before_finalizing(self):
words = ['peter', 'horst', 'gandalf', 'frodo']
tree = KeywordTree(case_insensitive=True)
for word in words:
tree.add(word)
as_bytes = dumps(tree)

self.assertIsNotNone(as_bytes)

deserialized = loads(as_bytes)

self.assertIsNotNone(deserialized)

deserialized.finalize()

text = 'Gollum did not like frodo. But gandalf did.'

results = deserialized.search_all(text)

self.assertEqual(('frodo', 20), next(results))
self.assertEqual(('gandalf', 31), next(results))

def test_state_to_string(self):
words = ['peter', 'horst', 'gandalf', 'frodo']
tree = KeywordTree(case_insensitive=True)
for word in words:
tree.add(word)
tree.finalize()
as_string = str(tree._zero_state)
self.assertIsNotNone(as_string)


if __name__ == '__main__':
unittest.main()
3 changes: 3 additions & 0 deletions tox.ini
Expand Up @@ -12,3 +12,6 @@ deps =
pytest-cov
pytest-pep8
usedevelop = True

[pytest]
pep8maxlinelength = 160

0 comments on commit 2ef8011

Please sign in to comment.