'Test for inserting all protocol v4 column types into a Model
test_can_insert_model_with_all_protocol_v4_column_types tests that each cqlengine protocol v4 column type can be
inserted into a Model. It first creates a Model that has each cqlengine protocol v4 column type. It then creates
a Model instance where all the fields have corresponding data, which performs the insert into the Cassandra table.
Finally, it verifies that each column read from the Model from Cassandra is the same as the input parameters.
@since 2.6.0
@jira_ticket PYTHON-245
@expected_result The Model is inserted with each protocol v4 column type, and the resulting read yields proper data for each column.
@test_category data_types:primitive'

def test_can_insert_model_with_all_protocol_v4_column_types(self):

    if (PROTOCOL_VERSION < 4):
        raise unittest.SkipTest('Protocol    v4    datatypes    require    native    protocol    4+,    currently    using:    {0}'.format(PROTOCOL_VERSION))
    class v4DatatypesModel(Model, ):
        id = columns.Integer(primary_key=True)
        a = columns.Date()
        b = columns.SmallInt()
        c = columns.Time()
        d = columns.TinyInt()
    sync_table(v4DatatypesModel)
    input = [Date(date(1970, 1, 1)), 32523, Time(time(16, 47, 25, 7)), 123]
    v4DatatypesModel.create(id=0, a=date(1970, 1, 1), b=32523, c=time(16, 47, 25, 7), d=123)
    self.assertEqual(1, v4DatatypesModel.objects.count())
    output = v4DatatypesModel.objects.first()
    for (i, i_char) in enumerate(range(ord('a'), (ord('a') + 3))):
        self.assertEqual(input[i], output[chr(i_char)])
