'Test for inserting various types of PRIMITIVE_DATATYPES into UDT\'s'

def test_can_insert_udt_all_datatypes(self):

    c = Cluster(protocol_version=PROTOCOL_VERSION)
    s = c.connect(self.keyspace_name, wait_for_all_pools=True)
    alpha_type_list = []
    start_index = ord('a')
    for (i, datatype) in enumerate(PRIMITIVE_DATATYPES):
        alpha_type_list.append('{0}    {1}'.format(chr((start_index + i)), datatype))
    s.execute('\n                                                CREATE    TYPE    alldatatypes    ({0})\n                                '.format(',    '.join(alpha_type_list)))
    s.execute('CREATE    TABLE    mytable    (a    int    PRIMARY    KEY,    b    frozen<alldatatypes>)')
    alphabet_list = []
    for i in range(ord('a'), (ord('a') + len(PRIMITIVE_DATATYPES))):
        alphabet_list.append('{0}'.format(chr(i)))
    Alldatatypes = namedtuple('alldatatypes', alphabet_list)
    c.register_user_type(self.keyspace_name, 'alldatatypes', Alldatatypes)
    params = []
    for datatype in PRIMITIVE_DATATYPES:
        params.append(get_sample(datatype))
    insert = s.prepare('INSERT    INTO    mytable    (a,    b)    VALUES    (?,    ?)')
    s.execute(insert, (0, Alldatatypes(*params)))
    results = s.execute('SELECT    *    FROM    mytable')
    row = results[0].b
    for (expected, actual) in zip(params, row):
        self.assertEqual(expected, actual)
    c.shutdown()
