Пример #1
0
    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 mock.patch('%s.open' % vocabcompiler.__name__,
                            return_value=f, create=True):
                extracted_phrases = vocabcompiler.get_keyword_phrases()
        self.assertEqual(expected_phrases, extracted_phrases)
Пример #2
0
    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 mock.patch('%s.open' % vocabcompiler.__name__,
                            return_value=f,
                            create=True):
                extracted_phrases = vocabcompiler.get_keyword_phrases()
        self.assertEqual(expected_phrases, extracted_phrases)
Пример #3
0
 def get_passive_instance(cls):
     phrases = vocabcompiler.get_keyword_phrases()
     return cls.get_instance('keyword', phrases)
Пример #4
0
 def get_passive_instance(cls):
     phrases = vocabcompiler.get_keyword_phrases()
     return cls.get_instance('keyword', phrases)