Barry Warsaw pushed to branch master at mailman / Mailman
Commits:
487da822 by Barry Warsaw at 2016-11-24T11:48:40-05:00
Minor style cleanup.
- - - - -
1 changed file:
- src/mailman/app/tests/test_workflow.py
Changes:
=====================================
src/mailman/app/tests/test_workflow.py
=====================================
--- a/src/mailman/app/tests/test_workflow.py
+++ b/src/mailman/app/tests/test_workflow.py
@@ -50,6 +50,26 @@ class MyWorkflow(Workflow):
return 'three'
+class DependentWorkflow(MyWorkflow):
+ SAVE_ATTRIBUTES = ('ant', 'bee', 'cat', 'elf')
+
+ def __init__(self):
+ super().__init__()
+ self._elf = 5
+
+ @property
+ def elf(self):
+ return self._elf
+
+ @elf.setter
+ def elf(self, value):
+ # This attribute depends on other attributes.
+ assert self.ant is not None
+ assert self.bee is not None
+ assert self.cat is not None
+ self._elf = value
+
+
class TestWorkflow(unittest.TestCase):
layer = ConfigLayer
@@ -117,30 +137,10 @@ class TestWorkflow(unittest.TestCase):
def test_save_and_restore_dependant_attributes(self):
# Attributes must be restored in the order they are declared in
# SAVE_ATTRIBUTES.
-
- class DependantWorkflow(MyWorkflow):
- SAVE_ATTRIBUTES = ('ant', 'bee', 'cat', 'elf')
-
- def __init__(self):
- super().__init__()
- self._elf = 5
-
- @property
- def elf(self):
- return self._elf
-
- @elf.setter
- def elf(self, value):
- # This attribute depends on other attributes.
- assert self.ant is not None
- assert self.bee is not None
- assert self.cat is not None
- self._elf = value
-
- workflow = iter(DependantWorkflow())
+ workflow = iter(DependentWorkflow())
workflow.elf = 6
workflow.save()
- new_workflow = DependantWorkflow()
+ new_workflow = DependentWorkflow()
# The elf attribute must be restored last, set triggering values for
# attributes it depends on.
new_workflow.ant = new_workflow.bee = new_workflow.cat = None
@@ -160,7 +160,7 @@ class TestWorkflow(unittest.TestCase):
try:
new_workflow.restore()
except KeyError:
- self.fail("Restore does not handle obsolete attributes")
+ self.fail('Restore does not handle obsolete attributes')
# Restoring must not raise an exception, the default value is kept.
self.assertEqual(new_workflow.cat, 3)
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/487da82226080986ec36bf09cee2f42ee79fc71c
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org