summaryrefslogtreecommitdiff
path: root/Mailman/tests/test_documentation.py
diff options
context:
space:
mode:
authorBarry Warsaw2007-12-29 19:53:23 -0500
committerBarry Warsaw2007-12-29 19:53:23 -0500
commit86f00a6cec71753952d1290bdadd836fdba5fdc1 (patch)
tree94bd4167060de21e706fc6dec1848092febaa57a /Mailman/tests/test_documentation.py
parent68cce110887cc9fc46fd4c7798f3b8d893f1038f (diff)
downloadmailman-86f00a6cec71753952d1290bdadd836fdba5fdc1.tar.gz
mailman-86f00a6cec71753952d1290bdadd836fdba5fdc1.tar.zst
mailman-86f00a6cec71753952d1290bdadd836fdba5fdc1.zip
Port the maximum message size check to a rule. Add doctest.
Rename the implicit.txt doctest. specialized_message_from_string(): Mimic the way the text->message parser will include the size of the original text as an attribute on the message object. The maximum message size rule will use this information.
Diffstat (limited to 'Mailman/tests/test_documentation.py')
-rw-r--r--Mailman/tests/test_documentation.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Mailman/tests/test_documentation.py b/Mailman/tests/test_documentation.py
index 390ba6a66..36b3c7ecb 100644
--- a/Mailman/tests/test_documentation.py
+++ b/Mailman/tests/test_documentation.py
@@ -36,7 +36,19 @@ COMMASPACE = ', '
def specialized_message_from_string(text):
- return message_from_string(text, Message)
+ """Parse text into a message object.
+
+ This is specialized in the sense that an instance of Mailman's own Message
+ object is returned, and this message object has an attribute
+ `original_size` which is the pre-calculated size in bytes of the message's
+ text representation.
+ """
+ # This mimic what Switchboard.dequeue() does when parsing a message from
+ # text into a Message instance.
+ original_size = len(text)
+ message = message_from_string(text, Message)
+ message.original_size = original_size
+ return message
def setup(testobj):