def METHOD_NAME(self):
    with Cursor(user='weewx1', passwd='weewx1') as cursor:
        with self.assertRaises(OperationalError) as e:
            cursor.execute("SELECT foo from test_weewx1.bar")
        self.assertEqual(get_error(e), 1049)