-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1ac1cb
commit 5c72a9a
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from orangecontrib.text import Corpus | ||
from orangecontrib.text.vectorization import BowVectorizer | ||
from orangecontrib.text.widgets.utils.owbasevectorizer import OWBaseVectorizer | ||
from orangewidget.tests.base import WidgetTest | ||
|
||
|
||
class TestableBaseVectWidget(OWBaseVectorizer): | ||
name = "TBV" | ||
Method = BowVectorizer | ||
|
||
|
||
class TestOWBaseVectorizer(WidgetTest): | ||
def setUp(self): | ||
self.widget = self.create_widget(TestableBaseVectWidget) | ||
self.corpus = Corpus.from_file('deerwester') | ||
|
||
def test_hide_attributes(self): | ||
self.send_signal("Corpus", self.corpus) | ||
self.assertTrue(all(f.attributes['hidden'] for f in | ||
self.get_output("Corpus").domain.attributes)) | ||
self.widget.controls.hidden_cb.setChecked(False) | ||
self.assertFalse(all(f.attributes['hidden'] for f in | ||
self.get_output("Corpus").domain.attributes)) | ||
new_corpus = Corpus.from_file('book-excerpts')[:10] | ||
self.send_signal("Corpus", new_corpus) | ||
self.assertFalse(all(f.attributes['hidden'] for f in | ||
self.get_output("Corpus").domain.attributes)) |