def runTest(self): c = SubcorpusItem(name='korpus syn 2010') c.corpus_id = 'public/syn2010' c.canonical_id = 'syn2010' c.subcorpus_id = 'modern_poetry' c.size = 123000 data = json.loads(json.dumps(c, cls=ItemEncoder)) self.assertEqual(data['id'], c.id) self.assertEqual(data['type'], c.type) self.assertEqual(data['name'], c.name) self.assertEqual(data['corpus_id'], c.corpus_id) self.assertEqual(data['canonical_id'], c.canonical_id) self.assertEqual(data['subcorpus_id'], c.subcorpus_id) self.assertEqual(data['size'], c.size)
def runTest(self): with self.assertRaises(AttributeError): c = SubcorpusItem(name='korpus syn 2010') c.type = 'foo'