'Test to validate that UNSET_VALUEs are bound, and have the expected effect
Prepare a statement and insert all values. Then follow with execute excluding
parameters. Verify that the original values are unaffected.
@since 2.6.0
@jira_ticket PYTHON-317
@expected_result UNSET_VALUE is implicitly added to bind parameters, and properly encoded, leving unset values unaffected.
@test_category prepared_statements:binding'

def test_unset_values(self):

    if (PROTOCOL_VERSION < 4):
        raise unittest.SkipTest('Binding    UNSET    values    is    not    supported    in    protocol    version    <    4')
    self.session.execute('CREATE    TABLE    IF    NOT    EXISTS    test1rf.test_unset_values    (k    int    PRIMARY    KEY,    v0    int,    v1    int)')
    insert = self.session.prepare('INSERT    INTO    test1rf.test_unset_values    (k,    v0,    v1)    VALUES        (?,    ?,    ?)')
    select = self.session.prepare('SELECT    *    FROM    test1rf.test_unset_values    WHERE    k=?')
    bind_expected = [((0, 0, 0), (0, 0, 0)), ((0, 1), (0, 1, 0)), ({'k': 0, 'v0': 2}, (0, 2, 0)), ({'k': 0, 'v1': 1}, (0, 2, 1)), ((0, 3, UNSET_VALUE), (0, 3, 1)), ((0, UNSET_VALUE, 2), (0, 3, 2)), ({'k': 0, 'v0': 4, 'v1': UNSET_VALUE}, (0, 4, 2)), ({'k': 0, 'v0': UNSET_VALUE, 'v1': 3}, (0, 4, 3)), ((0, None, None), (0, None, None))]
    for (params, expected) in bind_expected:
        self.session.execute(insert, params)
        results = self.session.execute(select, (0,))
        self.assertEqual(results[0], expected)
    self.assertRaises(ValueError, self.session.execute, select, (UNSET_VALUE, 0, 0))
