summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-10-08 16:41:20 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2014-10-08 20:53:10 +0200
commitf8ead5d8fbaba38364702332a50a87471175b65e (patch)
treec2567a7fe97094f63667bef11ccb38251ea25cc3
parentffce99db9f6ade908a0b0f7c1fc847dad84b49bd (diff)
downloadjasper-client-f8ead5d8fbaba38364702332a50a87471175b65e.tar.gz
jasper-client-f8ead5d8fbaba38364702332a50a87471175b65e.zip
Add test for keyword phrase extraction
-rw-r--r--client/test.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/client/test.py b/client/test.py
index f661b89..0269d18 100644
--- a/client/test.py
+++ b/client/test.py
@@ -40,6 +40,19 @@ class TestVocabCompiler(unittest.TestCase):
extracted_phrases = vocabcompiler.get_all_phrases()
self.assertEqual(expected_phrases, extracted_phrases)
+ def testKeywordPhraseExtraction(self):
+ expected_phrases = ['MOCK']
+
+ with tempfile.TemporaryFile() as f:
+ # We can't use mock_open here, because it doesn't seem to work
+ # with the 'for line in f' syntax
+ f.write("MOCK\n")
+ f.seek(0)
+ with patch('%s.open' % vocabcompiler.__name__,
+ return_value=f, create=True):
+ extracted_phrases = vocabcompiler.get_keyword_phrases()
+ self.assertEqual(expected_phrases, extracted_phrases)
+
class TestVocabulary(unittest.TestCase):
VOCABULARY = vocabcompiler.DummyVocabulary