Skip to content
Snippets Groups Projects
Commit 7c7407e7 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

add extra tests for exceptions

parent 7d4ec80e
No related branches found
No related tags found
No related merge requests found
class BaseSatellaException(Exception):
def __init__(self, msg):
super(BaseSatellaException, self).__init__()
def __init__(self, msg, *args, **kwargs):
super().__init__(*((msg, )+args))
self.msg = msg
def __str__(self):
return '%s(%s)' % (self.__class__.__qualname__, repr(self.msg),)
return '%s(%s)' % ((self.__class__.__qualname__,) + self.args)
class ResourceLocked(BaseSatellaException):
......
import unittest
import typing as tp
from satella.exceptions import BaseSatellaException
class TestExceptions(unittest.TestCase):
def test_exception(self):
try:
raise BaseSatellaException('message', 'arg1', 'arg2')
except BaseSatellaException as e:
self.assertIn('arg1', str(e))
self.assertIn('arg2', str(e))
else:
self.fail()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment