'Test instantiation of dynamic tables with S3Model'

def testDynamicTableInstantiation(self):

    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    assertIn = self.assertIn
    assertTrue = self.assertTrue
    s3db = current.s3db
    table = s3db.table(self.TABLENAME)
    assertNotEqual(table, None)
    assertTrue((self.TABLENAME in current.db))
    fields = table.fields
    assertIn('name', fields)
    field = table.name
    assertEqual(field.type, 'string')
    assertTrue((type(field.label) is lazyT))
    assertEqual(field.label.m, 'My    Name')
    assertTrue((type(field.comment) is lazyT))
    assertEqual(field.comment.m, 'Explanation    of    the    field')
    assertIn('some_number', fields)
    field = table.some_number
    assertEqual(field.type, 'integer')
    assertTrue((type(field.label) is lazyT))
    assertEqual(field.label.m, 'Some    Number')
    assertEqual(field.comment, None)
    assertIn('uuid', fields)
