def METHOD_NAME(self):
    with self.assertRaises(OperationalError) as e:
        with Cursor(user='weewx1', passwd='weewx1', db='test_weewx1') as cursor:
            pass
    self.assertEqual(get_error(e), 1049)