'Test the insertion of UDTs with null and empty string fields'

def test_can_insert_udts_with_nulls(self):

    c = Cluster(protocol_version=PROTOCOL_VERSION)
    s = c.connect(self.keyspace_name, wait_for_all_pools=True)
    s.execute('CREATE    TYPE    user    (a    text,    b    int,    c    uuid,    d    blob)')
    User = namedtuple('user', ('a', 'b', 'c', 'd'))
    c.register_user_type(self.keyspace_name, 'user', User)
    s.execute('CREATE    TABLE    mytable    (a    int    PRIMARY    KEY,    b    frozen<user>)')
    insert = s.prepare('INSERT    INTO    mytable    (a,    b)    VALUES    (0,    ?)')
    s.execute(insert, [User(None, None, None, None)])
    results = s.execute('SELECT    b    FROM    mytable    WHERE    a=0')
    self.assertEqual((None, None, None, None), results[0].b)
    select = s.prepare('SELECT    b    FROM    mytable    WHERE    a=0')
    self.assertEqual((None, None, None, None), s.execute(select)[0].b)
    s.execute(insert, [User('', None, None, six.binary_type())])
    results = s.execute('SELECT    b    FROM    mytable    WHERE    a=0')
    self.assertEqual(('', None, None, six.binary_type()), results[0].b)
    c.shutdown()
