'Test to write several Duration values to the database and verify
they can be read correctly. The verify than an exception is arisen
if the value is too big
@since 3.10
@jira_ticket PYTHON-747
@expected_result the read value in C* matches the written one
@test_category data_types serialization'

@greaterthanorequalcass3_10
def test_smoke_duration_values(self):

    self.session.execute('\n                                                CREATE    TABLE    duration_smoke    (k    int    primary    key,    v    duration)\n                                                ')
    self.addCleanup(self.session.execute, 'DROP    TABLE    duration_smoke')
    prepared = self.session.prepare('\n                                                INSERT    INTO    duration_smoke    (k,    v)\n                                                VALUES    (?,    ?)\n                                                ')
    nanosecond_smoke_values = [0, (-1), 1, 100, 1000, 1000000, 1000000000, 10000000000000, (-9223372036854775807), 9223372036854775807, int('7FFFFFFFFFFFFFFF', 16), int('-7FFFFFFFFFFFFFFF', 16)]
    month_day_smoke_values = [0, (-1), 1, 100, 1000, 1000000, 1000000000, int('7FFFFFFF', 16), int('-7FFFFFFF', 16)]
    for nanosecond_value in nanosecond_smoke_values:
        for month_day_value in month_day_smoke_values:
            if ((month_day_value <= 0) != (nanosecond_value <= 0)):
                continue
            self.session.execute(prepared, (1, Duration(month_day_value, month_day_value, nanosecond_value)))
            results = self.session.execute('SELECT    *    FROM    duration_smoke')
            v = results[0][1]
            self.assertEqual(Duration(month_day_value, month_day_value, nanosecond_value), v, 'Error    encoding    value    {0},{0},{1}'.format(month_day_value, nanosecond_value))
    self.assertRaises(ValueError, self.session.execute, prepared, (1, Duration(0, 0, int('8FFFFFFFFFFFFFF0', 16))))
    self.assertRaises(ValueError, self.session.execute, prepared, (1, Duration(0, int('8FFFFFFFFFFFFFF0', 16), 0)))
    self.assertRaises(ValueError, self.session.execute, prepared, (1, Duration(int('8FFFFFFFFFFFFFF0', 16), 0, 0)))
