def test_extract_single_entity(self):
     entity_value = 'kanyewest'
     data = {
         'entities': {
             'hashtags': [{'text': entity_value}]
         }
     }
     actual_output = utils.extract_entity(data, 'entities.hashtags', 'text')
     self.assertEqual(entity_value, actual_output)
 def test_extract_multiple_entity(self):
     value_1 = 'kanyewest'
     value_2 = 'dannybrown'
     data = {
         'entities': {
             'hashtags': [{'text': value_1}, {'text': value_2}]
         }
     }
     expected_output = '{}/{}'.format(value_1, value_2)
     actual_output = utils.extract_entity(data, 'entities.hashtags', 'text')
     self.assertEqual(expected_output, actual_output)
예제 #3
0
 def test_extract_multiple_entity(self):
     value_1 = 'kanyewest'
     value_2 = 'dannybrown'
     data = {
         'entities': {
             'hashtags': [{
                 'text': value_1
             }, {
                 'text': value_2
             }]
         }
     }
     expected_output = '{}/{}'.format(value_1, value_2)
     actual_output = utils.extract_entity(data, 'entities.hashtags', 'text')
     self.assertEqual(expected_output, actual_output)
예제 #4
0
 def test_extract_single_entity(self):
     entity_value = 'kanyewest'
     data = {'entities': {'hashtags': [{'text': entity_value}]}}
     actual_output = utils.extract_entity(data, 'entities.hashtags', 'text')
     self.assertEqual(entity_value, actual_output)