File: test_err.py

package info (click to toggle)
python-pymysql 1.0.2-2%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 860 kB
  • sloc: python: 6,123; makefile: 153; sh: 44
file content (14 lines) | stat: -rw-r--r-- 388 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import unittest

from pymysql import err


__all__ = ["TestRaiseException"]


class TestRaiseException(unittest.TestCase):
    def test_raise_mysql_exception(self):
        data = b"\xff\x15\x04#28000Access denied"
        with self.assertRaises(err.OperationalError) as cm:
            err.raise_mysql_exception(data)
        self.assertEqual(cm.exception.args, (1045, "Access denied"))