Skip to content

Commit

Permalink
tests: non latin highliting
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcv committed Feb 20, 2019
1 parent 2411298 commit 0ef4fca
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions orangecontrib/text/widgets/tests/test_owcorpusviewer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
from AnyQt.QtTest import QSignalSpy
from Orange.widgets.tests.base import WidgetTest
from Orange.data import StringVariable

from orangecontrib.text.corpus import Corpus
from orangecontrib.text.widgets.owcorpusviewer import OWCorpusViewer
Expand Down Expand Up @@ -34,6 +35,27 @@ def test_highlighting(self):
html = self.widget.doc_webview.html()
self.assertIn('<mark data-markjs="true">', html)

def test_highlighting_non_latin(self):
documents = [
{
'content': """царстве есть сад с молодильными яблоками"""
}
]
metas = [
(StringVariable('content'), lambda doc: doc.get('content')),
]
dataset_name = 'RussianDocument'
corpus = Corpus.from_documents(documents, dataset_name, metas=metas)

self.send_signal(self.widget.Inputs.corpus, corpus)
self.widget.regexp_filter = "\\bсад\\b"
self.process_events()
self.widget.doc_webview.html()
spy = QSignalSpy(self.widget.doc_webview.loadFinished)
spy.wait()
html = self.widget.doc_webview.html()
self.assertIn('<mark data-markjs="true">', html)


if __name__ == "__main__":
unittest.main()

0 comments on commit 0ef4fca

Please sign in to comment.