summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_tstutil.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/tests/test_tstutil.py')
-rw-r--r--ipalib/tests/test_tstutil.py68
1 files changed, 34 insertions, 34 deletions
diff --git a/ipalib/tests/test_tstutil.py b/ipalib/tests/test_tstutil.py
index 76f819e4a..5916f9d24 100644
--- a/ipalib/tests/test_tstutil.py
+++ b/ipalib/tests/test_tstutil.py
@@ -26,23 +26,23 @@ import tstutil
class Prop(object):
def __init__(self, *ops):
- self.__ops = frozenset(ops)
- self.__prop = 'prop value'
+ self.__ops = frozenset(ops)
+ self.__prop = 'prop value'
def __get_prop(self):
- if 'get' not in self.__ops:
- raise AttributeError('get prop')
- return self.__prop
+ if 'get' not in self.__ops:
+ raise AttributeError('get prop')
+ return self.__prop
def __set_prop(self, value):
- if 'set' not in self.__ops:
- raise AttributeError('set prop')
- self.__prop = value
+ if 'set' not in self.__ops:
+ raise AttributeError('set prop')
+ self.__prop = value
def __del_prop(self):
- if 'del' not in self.__ops:
- raise AttributeError('del prop')
- self.__prop = None
+ if 'del' not in self.__ops:
+ raise AttributeError('del prop')
+ self.__prop = None
prop = property(__get_prop, __set_prop, __del_prop)
@@ -51,36 +51,36 @@ def test_yes_raised():
f = tstutil.raises
class SomeError(Exception):
- pass
+ pass
class AnotherError(Exception):
- pass
+ pass
def callback1():
- 'raises correct exception'
- raise SomeError()
+ 'raises correct exception'
+ raise SomeError()
def callback2():
- 'raises wrong exception'
- raise AnotherError()
+ 'raises wrong exception'
+ raise AnotherError()
def callback3():
- 'raises no exception'
+ 'raises no exception'
f(SomeError, callback1)
raised = False
try:
- f(SomeError, callback2)
+ f(SomeError, callback2)
except AnotherError:
- raised = True
+ raised = True
assert raised
raised = False
try:
- f(SomeError, callback3)
+ f(SomeError, callback3)
except tstutil.ExceptionNotRaised:
- raised = True
+ raised = True
assert raised
@@ -91,9 +91,9 @@ def test_no_set():
# Tests that ExceptionNotRaised is raised when prop *can* be set:
raised = False
try:
- tstutil.no_set(Prop('set'), 'prop')
+ tstutil.no_set(Prop('set'), 'prop')
except tstutil.ExceptionNotRaised:
- raised = True
+ raised = True
assert raised
@@ -104,9 +104,9 @@ def test_no_del():
# Tests that ExceptionNotRaised is raised when prop *can* be set:
raised = False
try:
- tstutil.no_del(Prop('del'), 'prop')
+ tstutil.no_del(Prop('del'), 'prop')
except tstutil.ExceptionNotRaised:
- raised = True
+ raised = True
assert raised
@@ -117,32 +117,32 @@ def test_read_only():
# Test that ExceptionNotRaised is raised when prop can be set:
raised = False
try:
- tstutil.read_only(Prop('get', 'set'), 'prop')
+ tstutil.read_only(Prop('get', 'set'), 'prop')
except tstutil.ExceptionNotRaised:
- raised = True
+ raised = True
assert raised
# Test that ExceptionNotRaised is raised when prop can be deleted:
raised = False
try:
- tstutil.read_only(Prop('get', 'del'), 'prop')
+ tstutil.read_only(Prop('get', 'del'), 'prop')
except tstutil.ExceptionNotRaised:
- raised = True
+ raised = True
assert raised
# Test that ExceptionNotRaised is raised when prop can be both set and
# deleted:
raised = False
try:
- tstutil.read_only(Prop('get', 'del'), 'prop')
+ tstutil.read_only(Prop('get', 'del'), 'prop')
except tstutil.ExceptionNotRaised:
- raised = True
+ raised = True
assert raised
# Test that AttributeError is raised when prop can't be read:
raised = False
try:
- tstutil.read_only(Prop(), 'prop')
+ tstutil.read_only(Prop(), 'prop')
except AttributeError:
- raised = True
+ raised = True
assert raised