Refactor and self test the CBOR sorting

This commit is contained in:
Conor Patrick
2019-04-11 13:42:17 -04:00
parent ca80329b4c
commit 78579c27dc
2 changed files with 24 additions and 7 deletions

View File

@@ -28,14 +28,21 @@ class Packet(object):
class Test:
def __init__(self, msg):
def __init__(self, msg, catch=None):
self.msg = msg
self.catch = catch
def __enter__(self,):
print(self.msg)
def __exit__(self, a, b, c):
print("Pass")
if self.catch is None:
print("Pass")
elif isinstance(b, self.catch):
print("Pass")
return b
else:
raise RuntimeError(f"Expected exception {self.catch} did not occur.")
class Tester: