def test_generate_models(self):
    models = self.introspector.generate_models()
    self.assertTrue(set(('category', 'col_types', 'fkpk', 'nugget', 'nullable', 'rel_model', 'underscores')).issubset(set(models)))

    def assertIsInstance(obj, klass):
        self.assertTrue(isinstance(obj, klass))
    category = models['category']
    self.assertEqual(sorted(category._meta.fields), ['id', 'name', 'parent'])
    assertIsInstance(category.id, AutoField)
    assertIsInstance(category.name, CharField)
    assertIsInstance(category.parent, ForeignKeyField)
    self.assertEqual(category.parent.rel_model, category)
    fkpk = models['fkpk']
    self.assertEqual(sorted(fkpk._meta.fields), ['col_types'])
    assertIsInstance(fkpk.col_types, ForeignKeyField)
    self.assertEqual(fkpk.col_types.rel_model, models['col_types'])
    self.assertTrue(fkpk.col_types.primary_key)
    relmodel = models['rel_model']
    self.assertEqual(sorted(relmodel._meta.fields), ['col_types', 'col_types_nullable', 'id'])
    assertIsInstance(relmodel.col_types, ForeignKeyField)
    assertIsInstance(relmodel.col_types_nullable, ForeignKeyField)
    self.assertFalse(relmodel.col_types.null)
    self.assertTrue(relmodel.col_types_nullable.null)
    self.assertEqual(relmodel.col_types.rel_model, models['col_types'])
    self.assertEqual(relmodel.col_types_nullable.rel_model, models['col_types'])
def test_generate_models(self):
    models = self.introspector.generate_models()
    self.assertTrue(set(('category', 'col_types', 'fkpk', 'nugget', 'nullable', 'rel_model', 'underscores')).issubset(set(models)))

    def assertIsInstance(obj, klass):
        self.assertTrue(isinstance(obj, klass))
    category = models['category']
    self.assertEqual(sorted(category._meta.fields), ['id', 'name', 'parent'])
    assertIsInstance(category.id, AutoField)
    assertIsInstance(category.name, CharField)
    assertIsInstance(category.parent, ForeignKeyField)
    self.assertEqual(category.parent.rel_model, category)
    fkpk = models['fkpk']
    self.assertEqual(sorted(fkpk._meta.fields), ['col_types'])
    assertIsInstance(fkpk.col_types, ForeignKeyField)
    self.assertEqual(fkpk.col_types.rel_model, models['col_types'])
    self.assertTrue(fkpk.col_types.primary_key)
    relmodel = models['rel_model']
    self.assertEqual(sorted(relmodel._meta.fields), ['col_types', 'col_types_nullable', 'id'])
    assertIsInstance(relmodel.col_types, ForeignKeyField)
    assertIsInstance(relmodel.col_types_nullable, ForeignKeyField)
    self.assertFalse(relmodel.col_types.null)
    self.assertTrue(relmodel.col_types_nullable.null)
    self.assertEqual(relmodel.col_types.rel_model, models['col_types'])
    self.assertEqual(relmodel.col_types_nullable.rel_model, models['col_types'])