8000 Skip severity_nonlocalized if libpq version is less than 9.6. · pangpang20/gaussdb-python@03e0a88 · GitHub
[go: up one dir, main page]

Skip to content

Commit 03e0a88

Browse files
committed
Skip severity_nonlocalized if libpq version is less than 9.6.
1 parent a1e8991 commit 03e0a88

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_errors.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def test_diag_all_attrs(pgconn):
4242
res = pgconn.make_empty_result(pq.ExecStatus.NONFATAL_ERROR)
4343
diag = e.Diagnostic(res)
4444
for d in pq.DiagnosticField:
45+
if d == pq.DiagnosticField.SEVERITY_NONLOCALIZED:
46+
continue
4547
val = getattr(diag, d.name.lower())
4648
assert val is None or isinstance(val, str)
4749

@@ -62,9 +64,11 @@ def check_val(self, v):
6264
monkeypatch.setattr(e.Diagnostic, "_error_message", check_val)
6365

6466
for to_check in pq.DiagnosticField:
67+
if to_check == pq.DiagnosticField.SEVERITY_NONLOCALIZED:
68+
continue
6569
getattr(diag, to_check.name.lower())
6670

67-
assert len(checked) == len(pq.DiagnosticField)
71+
assert len(checked) == len(pq.DiagnosticField)-1
6872

6973

7074
def test_diag_attr_values(conn):
@@ -175,6 +179,8 @@ def test_diag_pickle(conn):
175179

176180
assert isinstance(diag2, type(diag1))
177181
for f in pq.DiagnosticField:
182+
if f == pq.DiagnosticField.SEVERITY_NONLOCALIZED:
183+
continue
178184
assert getattr(diag1, f.name.lower()) == getattr(diag2, f.name.lower())
179185

180186
assert diag2.sqlstate == "42P01"

0 commit comments

Comments
 (0)
0