def test_clear_empty(self): batch = BatchStatement() batch.clear() self.assertFalse(batch._statements_and_parameters) self.assertIsNone(batch.keyspace) self.assertIsNone(batch.routing_key) self.assertFalse(batch.custom_payload) batch.add('something')
def test_clear(self): keyspace = 'keyspace' routing_key = 'routing_key' custom_payload = {'key': six.b('value')} ss = SimpleStatement('whatever', keyspace=keyspace, routing_key=routing_key, custom_payload=custom_payload) batch = BatchStatement() batch.add(ss) self.assertTrue(batch._statements_and_parameters) self.assertEqual(batch.keyspace, keyspace) self.assertEqual(batch.routing_key, routing_key) self.assertEqual(batch.custom_payload, custom_payload) batch.clear() self.assertFalse(batch._statements_and_parameters) self.assertIsNone(batch.keyspace) self.assertIsNone(batch.routing_key) self.assertFalse(batch.custom_payload) batch.add(ss)