class TestJoSenses(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_isas(self): resp = self.api.isas('mouse', 'NN', holingtype='stanford') assert not resp.has_error() def test_sense_cuis(self): resp = self.api.sense_cuis('mouse', 'NN', holingtype='stanford') assert not resp.has_error() def test_senses(self): resp = self.api.senses('mouse', 'NN') assert not resp.has_error() assert len(resp.senses) == 2 isas_mammal, mammal_sense = resp.isas('mammal') assert isas_mammal assert mammal_sense.cui == '0' has_sense_rat, sense = resp.has_sense('rat', 'NN') assert has_sense_rat has_sense_program, sense = resp.has_sense('program', 'VB') assert not has_sense_program def test_worse_trigram(self): res = self.api.senses('better', holingtype='trigram') has, sense = res.has_sense('worse') assert has def test_worse_trigram_stanford(self): res = self.api.senses('mouse', pos='NN') has, sense = res.has_sense('controller', pos='NN') assert has
class TestJoCount(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_jo_count_nn(self): resp = self.api.jo_count('mouse', 'NN') assert resp.has_error() is False assert resp.count > 1000 def test_count_vb(self): resp = self.api.jo_count('program', 'VB') assert not resp.has_error() assert resp.count > 10
class TestBimCount(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_bim_count(self): resp = self.api.bim_count('mouse', 'NN', 'dobj', holingtype='trigram') assert not resp.has_error()
class TestJoSimilarScore(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_similar_score(self): resp = self.api.similar_score('mouse', 'NN', 'cat', 'NN') assert resp.score > 70
class TestJoBimScore(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_jo_bim_score(self): resp = self.api.jo_bim_score('cat', 'NN', 'chase', 'VB', '-subj') assert not resp.has_error()
class TestBimScore(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_bim_score(self): resp = self.api.bim_score('mouse', 'NN') assert not resp.has_error() assert len(resp.contexts) > 0
class TestJoBimCount(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_jo_bim_count(self): resp = self.api.jo_bim_count('cat', 'NN', 'chase', 'VB', '-subj') assert not resp.has_error() assert resp.count is not None
class TestHoling(unittest.TestCase): def setUp(self): self.api = JoBimText() def test_holing_error(self): resp = self.api.holing('foo', holingtype='foo') self.assertRaises(requests.HTTPError) assert resp.has_error() assert resp.error_msg == 'Missing holingtype: foo' def test_holing(self): resp = self.api.holing('I shot the sheriff.') assert resp.has_error() is False assert len(resp.holings) is 6 @unittest.skip("results in timeout since 18.07.2018") def test_holing_trigram(self): resp = self.api.holing('I shot the sheriff.', holingtype='trigram') assert resp.has_error() is False assert resp.holingtype_name == 'trigram' assert len(resp.holings) is 5
def setUp(self): self.api = JoBimText()