'Test for ensuring extra-lengthy udts are properly inserted'

def test_can_insert_udts_with_varying_lengths(self):

    c = Cluster(protocol_version=PROTOCOL_VERSION)
    s = c.connect(self.keyspace_name, wait_for_all_pools=True)
    MAX_TEST_LENGTH = 254
    s.execute('CREATE    TYPE    lengthy_udt    ({0})'.format(',    '.join(['v_{0}    int'.format(i) for i in range(MAX_TEST_LENGTH)])))
    s.execute('CREATE    TABLE    mytable    (k    int    PRIMARY    KEY,    v    frozen<lengthy_udt>)')
    udt = namedtuple('lengthy_udt', tuple(['v_{0}'.format(i) for i in range(MAX_TEST_LENGTH)]))
    c.register_user_type(self.keyspace_name, 'lengthy_udt', udt)
    for i in (0, 1, 2, 3, MAX_TEST_LENGTH):
        params = ([j for j in range(i)] + [None for j in range((MAX_TEST_LENGTH - i))])
        created_udt = udt(*params)
        s.execute('INSERT    INTO    mytable    (k,    v)    VALUES    (0,    %s)', (created_udt,))
        result = s.execute('SELECT    v    FROM    mytable    WHERE    k=0')[0]
        self.assertEqual(created_udt, result.v)
    c.shutdown()
