Skip to content

Commit

Permalink
Adjust tests to new search
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdapretnar committed Oct 28, 2021
1 parent c12492a commit faba3b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions orangecontrib/text/widgets/tests/test_owcorpusviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_data(self):
def test_search(self):
self.send_signal(self.widget.Inputs.corpus, self.corpus)
self.widget.regexp_filter = "Human"
self.widget.refresh_search()
self.process_events()
out_corpus = self.get_output(self.widget.Outputs.matching_docs)
self.assertEqual(len(out_corpus), 1)
Expand All @@ -30,6 +31,7 @@ def test_search(self):
# first document is selected, when filter with word that is not in
# selected document out_corpus is None
self.widget.regexp_filter = "graph"
self.widget.refresh_search()
self.process_events()
out_corpus = self.get_output(self.widget.Outputs.matching_docs)
self.assertIsNone(out_corpus)
Expand All @@ -38,13 +40,15 @@ def test_search(self):

# when filter is removed, matched words is 0
self.widget.regexp_filter = ""
self.widget.refresh_search()
self.process_events()
self.assertEqual(self.widget.matches, 0)

def test_highlighting(self):
self.send_signal(self.widget.Inputs.corpus, self.corpus)
# no intersection between filter and selection
self.widget.regexp_filter = "graph"
self.widget.refresh_search()
self.process_events()
spy = QSignalSpy(self.widget.doc_webview.loadFinished)
spy.wait()
Expand All @@ -53,6 +57,7 @@ def test_highlighting(self):

# all documents are selected
self.widget.regexp_filter = "graph"
self.widget.refresh_search()
self.widget.doc_list.selectAll()
spy = QSignalSpy(self.widget.doc_webview.loadFinished)
spy.wait()
Expand All @@ -73,6 +78,7 @@ def test_highlighting_non_latin(self):

self.send_signal(self.widget.Inputs.corpus, corpus)
self.widget.regexp_filter = "\\bсад\\b"
self.widget.refresh_search()
self.process_events()
self.widget.doc_webview.html()
spy = QSignalSpy(self.widget.doc_webview.loadFinished)
Expand All @@ -84,6 +90,7 @@ def test_output(self):
""" Output is intersection between selection and filter """
self.send_signal(self.widget.Inputs.corpus, self.corpus)
self.widget.regexp_filter = "graph"
self.widget.refresh_search()
self.process_events()
self.assertIsNone(self.get_output(self.widget.Outputs.matching_docs))
self.assertEqual(
Expand All @@ -108,6 +115,7 @@ def test_output(self):
)

self.widget.regexp_filter = "human"
self.widget.refresh_search()
self.process_events()
# empty because none of matching documents is selected
self.assertIsNone(self.get_output(self.widget.Outputs.matching_docs))
Expand Down Expand Up @@ -145,6 +153,7 @@ def test_report(self):
self.widget.send_report()

self.widget.regexp_filter = "human"
self.widget.refresh_search()
self.process_events()
self.widget.send_report()

Expand Down

0 comments on commit faba3b1

Please sign in to comment.