summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/core/logs.py14
-rw-r--r--tests/glibext/binportion.py17
2 files changed, 11 insertions, 20 deletions
diff --git a/tests/core/logs.py b/tests/core/logs.py
index 69a4775..656d212 100644
--- a/tests/core/logs.py
+++ b/tests/core/logs.py
@@ -1,9 +1,3 @@
-#!/usr/bin/python3-dbg
-# -*- coding: utf-8 -*-
-
-
-# Tests validant le bon calcul d'empreintes.
-
from chrysacase import ChrysalideTestCase
from pychrysalide import core
@@ -15,13 +9,13 @@ class TestCoreLogs(ChrysalideTestCase):
def testDefaultLevel(self):
"""Ensure all messages are hidden by default."""
- self.assertEqual(core.get_verbosity(), core.LMT_COUNT)
+ self.assertEqual(core.get_verbosity(), core.LogMessageType.COUNT)
def testWrongLevel(self):
"""Verify the type of level when defining new verbosity."""
- with self.assertRaisesRegex(Exception, 'argument 1 must be int, not str'):
+ with self.assertRaisesRegex(Exception, 'unable to convert the provided argument to LogMessageType'):
core.set_verbosity('XXX')
@@ -29,6 +23,6 @@ class TestCoreLogs(ChrysalideTestCase):
def testWrongMessage(self):
"""Check for unhandled message level."""
- with self.assertRaisesRegex(Exception, 'Invalid type of message'):
+ with self.assertRaisesRegex(Exception, 'invalid value for LogMessageType'):
- core.log_message(core.LMT_COUNT, 'Message')
+ core.log_message(core.LogMessageType.COUNT, 'Message')
diff --git a/tests/glibext/binportion.py b/tests/glibext/binportion.py
index a95352e..8d5f3af 100644
--- a/tests/glibext/binportion.py
+++ b/tests/glibext/binportion.py
@@ -1,6 +1,3 @@
-#!/usr/bin/python3-dbg
-# -*- coding: utf-8 -*-
-
from chrysacase import ChrysalideTestCase
from pychrysalide.arch import vmpa
@@ -14,7 +11,7 @@ class TestPathNames(ChrysalideTestCase):
def testPortionProperties(self):
"""Validate various binary portion properties."""
- p = BinPortion(BinPortion.BPC_RAW, 0x102, 10)
+ p = BinPortion(BinPortion.BinaryPortionCode.RAW, 0x102, 10)
p.desc = 'ABC'
self.assertEqual(p.desc, 'ABC')
@@ -29,14 +26,14 @@ class TestPathNames(ChrysalideTestCase):
p.continuation = False
self.assertFalse(p.continuation)
- p.rights = BinPortion.PAC_ALL
- self.assertEqual(p.rights, BinPortion.PAC_READ | BinPortion.PAC_WRITE | BinPortion.PAC_EXEC)
+ p.rights = BinPortion.PortionAccessRights.ALL
+ self.assertEqual(p.rights, BinPortion.PortionAccessRights.READ | BinPortion.PortionAccessRights.WRITE | BinPortion.PortionAccessRights.EXEC)
def testPortionMethods(self):
"""Validate some binary portion methods."""
- p = BinPortion(BinPortion.BPC_RAW, 0x102, 10)
+ p = BinPortion(BinPortion.BinaryPortionCode.RAW, 0x102, 10)
self.assertEqual(p.range.length, 10)
@@ -52,9 +49,9 @@ class TestPathNames(ChrysalideTestCase):
def testPortionComparison(self):
"""Compare different binary portions."""
- p0 = BinPortion(BinPortion.BPC_CODE, 0x102, 10)
+ p0 = BinPortion(BinPortion.BinaryPortionCode.CODE, 0x102, 10)
- addr = vmpa(vmpa.VMPA_NO_PHYSICAL, 0x102)
- p1 = BinPortion(BinPortion.BPC_CODE, addr, 10)
+ addr = vmpa(vmpa.VmpaSpecialValue.NO_PHYSICAL, 0x102)
+ p1 = BinPortion(BinPortion.BinaryPortionCode.CODE, addr, 10)
self.assertEqual(p0, p1)