'Test tuple types of lengths of 1, 2, 3, and 384 to ensure edge cases work
as expected.'

def test_can_insert_tuples_with_varying_lengths(self):

    if (self.cass_version < (2, 1, 0)):
        raise unittest.SkipTest('The    tuple    type    was    introduced    in    Cassandra    2.1')
    c = Cluster(protocol_version=PROTOCOL_VERSION)
    s = c.connect(self.keyspace_name)
    s.row_factory = dict_factory
    s.encoder.mapping[tuple] = s.encoder.cql_encode_tuple
    lengths = (1, 2, 3, 384)
    value_schema = []
    for i in lengths:
        value_schema += [('    v_%s    frozen<tuple<%s>>' % (i, ',    '.join((['int'] * i))))]
    s.execute(('CREATE    TABLE    tuple_lengths    (k    int    PRIMARY    KEY,    %s)' % (',    '.join(value_schema),)))
    for i in lengths:
        created_tuple = tuple(range(0, (i + 1)))
        self.assertRaises(InvalidRequest, s.execute, 'INSERT    INTO    tuple_lengths    (k,    v_%s)    VALUES    (0,    %s)', (i, created_tuple))
        created_tuple = tuple(range(0, i))
        s.execute('INSERT    INTO    tuple_lengths    (k,    v_%s)    VALUES    (0,    %s)', (i, created_tuple))
        result = s.execute('SELECT    v_%s    FROM    tuple_lengths    WHERE    k=0', (i,))[0]
        self.assertEqual(tuple(created_tuple), result[('v_%s' % i)])
    c.shutdown()
