'Test warning for an invalid bulk size.'

def testWarnBulkSizeZero(self):

    class WarnBulkSizeZero(SeriesHelper, ):
        'Define    SeriesHelper    for    WarnBulkSizeZero    test.'
        class Meta:
            'Define    metadata    for    WarnBulkSizeZero    object.'
            client = TestSeriesHelper.client
            series_name = 'events.stats.{server_name}'
            fields = ['time', 'server_name']
            bulk_size = 0
            autocommit = True
    with warnings.catch_warnings(record=True) as rec_warnings:
        warnings.simplefilter('always')
        with self.assertRaises(ConnectionError):
            WarnBulkSizeZero(time=159, server_name='us.east-1')
    self.assertGreaterEqual(len(rec_warnings), 1, '{0}    call    should    have    generated    one    warning.Actual    generated    warnings:    {1}'.format(WarnBulkSizeZero, '\n'.join(map(str, rec_warnings))))
    expected_msg = 'Definition    of    bulk_size    in    WarnBulkSizeZero    forced    to    1,    was    less    than    1.'
    self.assertIn(expected_msg, list((w.message.args[0] for w in rec_warnings)), 'Warning    message    did    not    contain    "forced    to    1".')
