Skip to content

Commit

Permalink
Merge pull request #2737 from dhermes/fix-flaky-language-sys-test
Browse files Browse the repository at this point in the history
Accounting extra data in language system test.
  • Loading branch information
dhermes authored Nov 14, 2016
2 parents 3b2520f + 1180e23 commit 2f49740
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions system_tests/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,19 @@ def _check_analyze_entities_result(self, entities):
self.assertEqual(entity1.name, self.NAME1)
self.assertEqual(entity1.entity_type, EntityType.PERSON)
self.assertGreater(entity1.salience, 0.0)
self.assertEqual(entity1.mentions, [entity1.name])
# Other mentions may occur, e.g. "painter".
self.assertIn(entity1.name, entity1.mentions)
self.assertEqual(entity1.wikipedia_url,
'http://en.wikipedia.org/wiki/Caravaggio')
self.assertEqual(entity1.metadata, {})
self.assertIsInstance(entity1.metadata, dict)
# Verify entity 2.
self.assertEqual(entity2.name, self.NAME2)
self.assertEqual(entity2.entity_type, EntityType.LOCATION)
self.assertGreater(entity2.salience, 0.0)
self.assertEqual(entity2.mentions, [entity2.name])
self.assertEqual(entity2.wikipedia_url,
'http://en.wikipedia.org/wiki/Italy')
self.assertEqual(entity2.metadata, {})
self.assertIsInstance(entity2.metadata, dict)
# Verify entity 3.
self.assertEqual(entity3.name, self.NAME3)
choices = (EntityType.EVENT, EntityType.WORK_OF_ART)
Expand All @@ -95,7 +96,7 @@ def _check_analyze_entities_result(self, entities):
wiki_url = ('http://en.wikipedia.org/wiki/'
'The_Calling_of_St_Matthew_(Caravaggio)')
self.assertEqual(entity3.wikipedia_url, wiki_url)
self.assertEqual(entity3.metadata, {})
self.assertIsInstance(entity3.metadata, dict)

def test_analyze_entities(self):
document = Config.CLIENT.document_from_text(self.TEXT_CONTENT)
Expand Down

0 comments on commit 2f49740

Please sign in to comment.