MCPcopy Index your code
hub / github.com/clips/pattern / test_convergence

Method test_convergence

test/test_search.py:394–403  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

392 print "pattern.search.Pattern.search()"
393
394 def test_convergence(self):
395 # Test with random sentences and random patterns to see if it crashes.
396 w = ("big", "white", "rabbit", "black", "cats", "is", "was", "going", "to", "sleep", "sleepy", "very", "or")
397 x = ("DT?", "JJ?+", "NN*", "VP?", "cat", "[*]")
398 for i in range(100):
399 s = " ".join(random.choice(w) for i in range(20))
400 s = Sentence(parse(s, lemmata=True))
401 p = " ".join(random.choice(x) for i in range(5))
402 p = search.Pattern.fromstring(p)
403 p.search(s)
404
405 def test_compile_function(self):
406 # Assert creating and caching Pattern with compile().

Callers

nothing calls this directly

Calls 4

parseFunction · 0.90
SentenceClass · 0.50
fromstringMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected