summaryrefslogtreecommitdiff
path: root/tests/test_module.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-10-15 00:58:32 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-10-15 00:58:32 +0100
commitb205764fdde4549c48c27841aa17e6c7f499e808 (patch)
tree1475eb57dc854ea4a1dc93c1c6a567e6fc584e5c /tests/test_module.py
parente7227ce87b8da75fef1a3376ebb47e2bf20f6063 (diff)
parent7a5edff6c66a0410d6fecd4445980aabafc3ab4a (diff)
downloadpsycopg2-errors-module.tar.gz
Merge branch 'master' into errors-moduleerrors-module
Diffstat (limited to 'tests/test_module.py')
-rwxr-xr-xtests/test_module.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_module.py b/tests/test_module.py
index ddd6b02..cf3eb02 100755
--- a/tests/test_module.py
+++ b/tests/test_module.py
@@ -173,8 +173,8 @@ class ExceptionsTestCase(ConnectingTestCase):
'column_name', 'constraint_name', 'context', 'datatype_name',
'internal_position', 'internal_query', 'message_detail',
'message_hint', 'message_primary', 'schema_name', 'severity',
- 'source_file', 'source_function', 'source_line', 'sqlstate',
- 'statement_position', 'table_name', ]:
+ 'severity_nonlocalized', 'source_file', 'source_function',
+ 'source_line', 'sqlstate', 'statement_position', 'table_name', ]:
v = getattr(diag, attr)
if v is not None:
self.assert_(isinstance(v, str))
@@ -276,6 +276,15 @@ class ExceptionsTestCase(ConnectingTestCase):
self.assertEqual(e.diag.constraint_name, "chk_eq1")
self.assertEqual(e.diag.datatype_name, None)
+ @skip_before_postgres(9, 6)
+ def test_9_6_diagnostics(self):
+ cur = self.conn.cursor()
+ try:
+ cur.execute("select 1 from nosuchtable")
+ except psycopg2.Error as exc:
+ e = exc
+ self.assertEqual(e.diag.severity_nonlocalized, 'ERROR')
+
def test_pickle(self):
import pickle
cur = self.conn.cursor()