Ejemplo n.º 1
0
 def test_from_dict(self):
     raw_data = {
         'definition': 'term definition',
         'id': 12345,
         'image': None,
         'rank': 0,
         'term': 'term'
     }
     term = Term.from_dict(raw_data)
     assert term.definition == 'term definition'
     assert term.term_id == 12345
     assert term.image.url is None
     assert term.rank == 0
     assert term.term == 'term'
Ejemplo n.º 2
0
 def test_wrong_term_json_structure(self):
     with self.assertRaises(ValueError):
         Term.from_dict({'some data': '142% unexpected'})