class documentation

Tests for flattening various things.

Method checkAttributeSanitization Common implementation of test_serializedAttributeWithSanitization and test_serializedDeferredAttributeWithSanitization, test_serializedAttributeWithTransparentTag.
Method checkTagAttributeSerialization Common implementation of test_serializedAttributeWithTag and test_serializedAttributeWithDeferredTag.
Method test_commentEscaping The data in a Comment is escaped and mangled in the flattened output so that the result is a legal SGML and XML comment.
Method test_nestedTags Test that nested tags flatten correctly.
Method test_serializeAttribute The serialized form of attribute a with value b is 'a="b"'.
Method test_serializeCDATA Test that CDATA is correctly flattened and escaped.
Method test_serializeCharRef A character reference is flattened to a string using the &#NNNN; syntax.
Method test_serializeComment Test that comments are correctly flattened and escaped.
Method test_serializeCoroutine Test that a coroutine returning a value is substituted with the that value when flattened.
Method test_serializeCoroutineWithAwait Test that a coroutine returning an awaited deferred value is substituted with that value when flattened.
Method test_serializedAttributeWithDeferredTag Like test_serializedAttributeWithTag, but when the Tag is in a Deferred.
Method test_serializedAttributeWithRenderable Like test_serializedAttributeWithTransparentTag, but when the attribute is a provider of IRenderable rather than a transparent tag.
Method test_serializedAttributeWithSanitization Attribute values containing "<", ">", "&", or '"' have "&lt;", "&gt;", "&amp;", or "&quot;" substituted for those bytes in the serialized output.
Method test_serializedAttributeWithSlotWithSanitization Like test_serializedAttributeWithSanitization but with a slot.
Method test_serializedAttributeWithTag Tag objects which are serialized within the context of an attribute are serialized such that the text content of the attribute may be parsed to retrieve the tag.
Method test_serializedAttributeWithTagWithAttribute Similar to test_serializedAttributeWithTag, but for the additional complexity where the tag which is the attribute value itself has an attribute value which contains bytes which require substitution.
Method test_serializedAttributeWithTransparentTag Attribute values which are supplied via the value of a t:transparent tag have the same substitution rules to them as values supplied directly.
Method test_serializedAttributeWithTransparentTagWithRenderer Like test_serializedAttributeWithTransparentTag, but when the attribute is rendered by a renderer on an element.
Method test_serializedDeferredAttributeWithSanitization Like test_serializedAttributeWithSanitization, but when the contents of the attribute are in a Deferred.
Method test_serializeDeferred Test that a deferred is substituted with the current value in the callback chain when flattened.
Method test_serializeDeferredSlots Test that a slot with a deferred as its value will be flattened using the value from the deferred.
Method test_serializedMultipleAttributes Multiple attributes are separated by a single space in their serialized form.
Method test_serializeIRenderable Test that flattening respects all of the IRenderable interface.
Method test_serializeMissingRenderFactory Test that flattening a tag with a render attribute when no render factory is available in the context raises an exception.
Method test_serializeSameDeferredTwice Test that the same deferred can be flattened twice.
Method test_serializeSelfClosingTags The serialized form of a self-closing tag is '<tagName />'.
Method test_serializeSlots Test that flattening a slot will use the slot value from the tag.
Method test_serializeString Test that strings will be flattened and escaped correctly.
Method test_serializeUnicode Test that unicode is encoded correctly in the appropriate places, and raises an error when it occurs in inappropriate place.
Method test_unknownTypeRaises Test that flattening an unknown type of thing raises an exception.

Inherited from FlattenTestCase:

Method assertFlatteningRaises Assert flattening a root element raises a particular exception.
Method assertFlattensImmediately Assert that a root element, when flattened, is equal to a string, and performs no asynchronus Deferred anything.
Method assertFlattensTo Assert that a root element, when flattened, is equal to a string.

Inherited from SynchronousTestCase (via FlattenTestCase):

Method __eq__ Override the comparison defined by the base TestCase which considers instances of the same class with the same _testMethodName to be equal. Since trial puts TestCase instances into a set, that definition of comparison makes it impossible to run the same test method twice...
Method __hash__ Undocumented
Method __init__ Undocumented
Method addCleanup Add the given function to a list of functions to be called after the test has run, but before tearDown.
Method callDeprecated Call a function that should have been deprecated at a specific version and in favor of a specific alternative, and assert that it was thusly deprecated.
Method flushLoggedErrors Remove stored errors received from the log.
Method flushWarnings Remove stored warnings from the list of captured warnings and return them.
Method getDeprecatedModuleAttribute Retrieve a module attribute which should have been deprecated, and assert that we saw the appropriate deprecation warning.
Method getSkip Return the skip reason set on this test, if any is set. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a skip attribute, returns that in a tuple (...
Method getTodo Return a Todo object if the test is marked todo. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a todo attribute, returns that. Returns ...
Method mktemp Create a new path name which can be used for a new file or directory.
Method patch Monkey patch an object for the duration of the test.
Method run Run the test case, storing the results in result.
Method runTest If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside.
Method shortDescription Undocumented
Instance Variable failureException An exception class, defaulting to FailTest. If the test method raises this exception, it will be reported as a failure, rather than an exception. All of the assertion methods raise this if the assertion fails.
Instance Variable skip None or a string explaining why this test is to be skipped. If defined, the test will not be run. Instead, it will be reported to the result object as 'skipped' (if the TestResult supports skipping).
Instance Variable suppress None or a list of tuples of (args, kwargs) to be passed to warnings.filterwarnings. Use these to suppress warnings raised in a test. Useful for testing deprecated code. See also util.suppress.
Instance Variable todo None, a string or a tuple of (errors, reason) where errors is either an exception class or an iterable of exception classes, and reason is a string. See Todo or makeTodo for more information.
Method _getSkipReason Return the reason to use for skipping a test method.
Method _getSuppress Returns any warning suppressions set for this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a suppress attribute, returns that. ...
Method _installObserver Undocumented
Method _removeObserver Undocumented
Method _run Run a single method, either a test method or fixture.
Method _runCleanups Synchronously run any cleanups which have been added.
Method _runFixturesAndTest Run setUp, a test method, test cleanups, and tearDown.
Instance Variable _cleanups Undocumented
Instance Variable _observer Undocumented
Instance Variable _parents Undocumented
Instance Variable _passed Undocumented
Instance Variable _testMethodName Undocumented
Instance Variable _warnings Undocumented

Inherited from _Assertions (via FlattenTestCase, SynchronousTestCase):

Method assertAlmostEqual Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Method assertApproximates Fail if first - second > tolerance
Method assertEqual Fail the test if first and second are not equal.
Method assertFalse Fail the test if condition evaluates to True.
Method assertIn Fail the test if containee is not found in container.
Method assertIs Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertIsInstance Fail if instance is not an instance of the given class or of one of the given classes.
Method assertIsNot Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertNoResult Assert that deferred does not have a result at this point.
Method assertNotAlmostEqual Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Method assertNotEqual Fail the test if first == second.
Method assertNotIn Fail the test if containee is found in container.
Method assertNotIsInstance Fail if instance is an instance of the given class or of one of the given classes.
Method assertNotSubstring Fail if astring contains substring.
Method assertRaises Fail the test unless calling the function f with the given args and kwargs raises exception. The failure will report the traceback and call stack of the unexpected exception.
Method assertSubstring Fail if substring does not exist within astring.
Method assertTrue Fail the test if condition evaluates to False.
Method assertWarns Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine.
Method fail Absolutely fail the test. Do not pass go, do not collect $200.
Method failureResultOf Return the current failure result of deferred or raise self.failureException.
Method successResultOf Return the current success result of deferred or raise self.failureException.

Inherited from XMLAssertionMixin (via FlattenTestCase, SynchronousTestCase, _Assertions):

Method assertXMLEqual Verify that two strings represent the same XML document.
def checkAttributeSanitization(self, wrapData, wrapTag): (source)

Common implementation of test_serializedAttributeWithSanitization and test_serializedDeferredAttributeWithSanitization, test_serializedAttributeWithTransparentTag.

Parameters
wrapData:Callable[[str], Flattenable]A 1-argument callable that wraps around the attribute's value so other tests can customize it.
wrapTag:Callable[[Tag], Flattenable]A 1-argument callable that wraps around the outer tag so other tests can customize it.
def checkTagAttributeSerialization(self, wrapTag): (source)

Common implementation of test_serializedAttributeWithTag and test_serializedAttributeWithDeferredTag.

Parameters
wrapTag:callable taking Tag and returning something flattenableA 1-argument callable that wraps around the attribute's value so other tests can customize it.
def test_commentEscaping(self): (source)

The data in a Comment is escaped and mangled in the flattened output so that the result is a legal SGML and XML comment.

SGML comment syntax is complicated and hard to use. This rule is more restrictive, and more compatible:

Comments start with <!-- and end with --> and never contain -- or >.

Also by XML syntax, a comment may not end with '-'.

Returns
Deferred[List[bytes]]Undocumented
See Also
http://www.w3.org/TR/REC-xml/#sec-comments
def test_nestedTags(self): (source)

Test that nested tags flatten correctly.

def test_serializeAttribute(self): (source)

The serialized form of attribute a with value b is 'a="b"'.

def test_serializeCDATA(self): (source)

Test that CDATA is correctly flattened and escaped.

def test_serializeCharRef(self): (source)

A character reference is flattened to a string using the &#NNNN; syntax.

def test_serializeComment(self): (source)

Test that comments are correctly flattened and escaped.

def test_serializeCoroutine(self): (source)

Test that a coroutine returning a value is substituted with the that value when flattened.

def test_serializeCoroutineWithAwait(self): (source)

Test that a coroutine returning an awaited deferred value is substituted with that value when flattened.

def test_serializedAttributeWithDeferredTag(self): (source)

Like test_serializedAttributeWithTag, but when the Tag is in a Deferred.

def test_serializedAttributeWithRenderable(self): (source)

Like test_serializedAttributeWithTransparentTag, but when the attribute is a provider of IRenderable rather than a transparent tag.

def test_serializedAttributeWithSanitization(self): (source)

Attribute values containing "<", ">", "&", or '"' have "&lt;", "&gt;", "&amp;", or "&quot;" substituted for those bytes in the serialized output.

def test_serializedAttributeWithSlotWithSanitization(self): (source)
def test_serializedAttributeWithTag(self): (source)

Tag objects which are serialized within the context of an attribute are serialized such that the text content of the attribute may be parsed to retrieve the tag.

def test_serializedAttributeWithTagWithAttribute(self): (source)

Similar to test_serializedAttributeWithTag, but for the additional complexity where the tag which is the attribute value itself has an attribute value which contains bytes which require substitution.

def test_serializedAttributeWithTransparentTag(self): (source)

Attribute values which are supplied via the value of a t:transparent tag have the same substitution rules to them as values supplied directly.

def test_serializedAttributeWithTransparentTagWithRenderer(self): (source)

Like test_serializedAttributeWithTransparentTag, but when the attribute is rendered by a renderer on an element.

def test_serializedDeferredAttributeWithSanitization(self): (source)

Like test_serializedAttributeWithSanitization, but when the contents of the attribute are in a Deferred.

def test_serializeDeferred(self): (source)

Test that a deferred is substituted with the current value in the callback chain when flattened.

def test_serializeDeferredSlots(self): (source)

Test that a slot with a deferred as its value will be flattened using the value from the deferred.

def test_serializedMultipleAttributes(self): (source)

Multiple attributes are separated by a single space in their serialized form.

def test_serializeIRenderable(self): (source)

Test that flattening respects all of the IRenderable interface.

def test_serializeMissingRenderFactory(self): (source)

Test that flattening a tag with a render attribute when no render factory is available in the context raises an exception.

def test_serializeSameDeferredTwice(self): (source)

Test that the same deferred can be flattened twice.

def test_serializeSelfClosingTags(self): (source)

The serialized form of a self-closing tag is '<tagName />'.

def test_serializeSlots(self): (source)

Test that flattening a slot will use the slot value from the tag.

def test_serializeString(self): (source)

Test that strings will be flattened and escaped correctly.

def test_serializeUnicode(self): (source)

Test that unicode is encoded correctly in the appropriate places, and raises an error when it occurs in inappropriate place.

def test_unknownTypeRaises(self): (source)

Test that flattening an unknown type of thing raises an exception.