[libxml2] Updated python/tests/tstLastError.py
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Updated python/tests/tstLastError.py
- Date: Thu, 2 Jan 2020 14:47:58 +0000 (UTC)
commit 8c3e52ebd956197634bd1ada589b119d9308670d
Author: Pieter van Oostrum <pieter vanoostrum org>
Date: Tue Dec 31 21:49:58 2019 +0100
Updated python/tests/tstLastError.py
libxml2.registerErrorHandler(None,None):
None is not acceptable as first argument
failUnlessEqual replaced by assertEqual
python/tests/tstLastError.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/python/tests/tstLastError.py b/python/tests/tstLastError.py
index 81d0acc4..1758a9fb 100755
--- a/python/tests/tstLastError.py
+++ b/python/tests/tstLastError.py
@@ -25,7 +25,10 @@ class TestCase(unittest.TestCase):
when the exception is raised, check the libxml2.lastError for
expected values."""
# disable the default error handler
- libxml2.registerErrorHandler(None,None)
+ def noerr(ctx, str):
+ pass
+ # None is not acceptable as function.
+ libxml2.registerErrorHandler(noerr,None)
try:
f(*args)
except exc:
@@ -40,12 +43,12 @@ class TestCase(unittest.TestCase):
print("file =",e.file())
print("line =",e.line())
print()
- self.failUnlessEqual(domain,e.domain())
- self.failUnlessEqual(code,e.code())
- self.failUnlessEqual(message,e.message())
- self.failUnlessEqual(level,e.level())
- self.failUnlessEqual(file,e.file())
- self.failUnlessEqual(line,e.line())
+ self.assertEqual(domain,e.domain())
+ self.assertEqual(code,e.code())
+ self.assertEqual(message,e.message())
+ self.assertEqual(level,e.level())
+ self.assertEqual(file,e.file())
+ self.assertEqual(line,e.line())
else:
self.fail("exception %s should have been raised" % exc)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]