class SerializationTests(FlattenTestCase, XMLAssertionMixin): (source)
Tests for flattening various things.
Method | check |
Common implementation of test_serializedAttributeWithSanitization and test_serializedDeferredAttributeWithSanitization , test_serializedAttributeWithTransparentTag . |
Method | check |
Common implementation of test_serializedAttributeWithTag and test_serializedAttributeWithDeferredTag . |
Method | test_comment |
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_nested |
Test that nested tags flatten correctly. |
Method | test_serialize |
The serialized form of attribute a with value b is 'a="b"'. |
Method | test_serialize |
Test that CDATA is correctly flattened and escaped. |
Method | test_serialize |
A character reference is flattened to a string using the &#NNNN; syntax. |
Method | test_serialize |
Test that comments are correctly flattened and escaped. |
Method | test_serialize |
Test that a coroutine returning a value is substituted with the that value when flattened. |
Method | test_serialize |
Test that a coroutine returning an awaited deferred value is substituted with that value when flattened. |
Method | test_serialized |
Like test_serializedAttributeWithTag , but when the Tag is in a Deferred . |
Method | test_serialized |
Like test_serializedAttributeWithTransparentTag , but when the attribute is a provider of IRenderable rather than a transparent tag. |
Method | test_serialized |
Attribute values containing "<", ">", "&", or '"' have "<", ">", "&", or """ substituted for those bytes in the serialized output. |
Method | test_serialized |
Like test_serializedAttributeWithSanitization but with a slot. |
Method | test_serialized |
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_serialized |
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_serialized |
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_serialized |
Like test_serializedAttributeWithTransparentTag , but when the attribute is rendered by a renderer on an element. |
Method | test_serialized |
Like test_serializedAttributeWithSanitization , but when the contents of the attribute are in a Deferred . |
Method | test_serialize |
Test that a deferred is substituted with the current value in the callback chain when flattened. |
Method | test_serialize |
Test that a slot with a deferred as its value will be flattened using the value from the deferred. |
Method | test_serialized |
Multiple attributes are separated by a single space in their serialized form. |
Method | test_serialize |
Test that flattening respects all of the IRenderable interface. |
Method | test_serialize |
Test that flattening a tag with a render attribute when no render factory is available in the context raises an exception. |
Method | test_serialize |
Test that the same deferred can be flattened twice. |
Method | test_serialize |
The serialized form of a self-closing tag is '<tagName />'. |
Method | test_serialize |
Test that flattening a slot will use the slot value from the tag. |
Method | test_serialize |
Test that strings will be flattened and escaped correctly. |
Method | test_serialize |
Test that unicode is encoded correctly in the appropriate places, and raises an error when it occurs in inappropriate place. |
Method | test_unknown |
Test that flattening an unknown type of thing raises an exception. |
Inherited from FlattenTestCase
:
Method | assert |
Assert flattening a root element raises a particular exception. |
Method | assert |
Assert that a root element, when flattened, is equal to a string, and performs no asynchronus Deferred anything. |
Method | assert |
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 | add |
Add the given function to a list of functions to be called after the test has run, but before tearDown. |
Method | call |
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 | flush |
Remove stored errors received from the log. |
Method | flush |
Remove stored warnings from the list of captured warnings and return them. |
Method | get |
Retrieve a module attribute which should have been deprecated, and assert that we saw the appropriate deprecation warning. |
Method | get |
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 | get |
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 | run |
If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside. |
Method | short |
Undocumented |
Instance Variable | failure |
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 | _get |
Return the reason to use for skipping a test method. |
Method | _get |
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 | _install |
Undocumented |
Method | _remove |
Undocumented |
Method | _run |
Run a single method, either a test method or fixture. |
Method | _run |
Synchronously run any cleanups which have been added. |
Method | _run |
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 | _test |
Undocumented |
Instance Variable | _warnings |
Undocumented |
Inherited from _Assertions
(via FlattenTestCase
, SynchronousTestCase
):
Method | assert |
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 | assert |
Fail if first - second > tolerance |
Method | assert |
Fail the test if first and second are not equal. |
Method | assert |
Fail the test if condition evaluates to True. |
Method | assert |
Fail the test if containee is not found in container. |
Method | assert |
Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test. |
Method | assert |
Fail if instance is not an instance of the given class or of one of the given classes. |
Method | assert |
Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test. |
Method | assert |
Assert that deferred does not have a result at this point. |
Method | assert |
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 | assert |
Fail the test if first == second. |
Method | assert |
Fail the test if containee is found in container. |
Method | assert |
Fail if instance is an instance of the given class or of one of the given classes. |
Method | assert |
Fail if astring contains substring. |
Method | assert |
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 | assert |
Fail if substring does not exist within astring. |
Method | assert |
Fail the test if condition evaluates to False. |
Method | assert |
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 | failure |
Return the current failure result of deferred or raise self.failureException. |
Method | success |
Return the current success result of deferred or raise self.failureException. |
Inherited from XMLAssertionMixin
(via FlattenTestCase
, SynchronousTestCase
, _Assertions
):
Method | assert |
Verify that two strings represent the same XML document. |
Common implementation of test_serializedAttributeWithSanitization
and test_serializedDeferredAttributeWithSanitization
, test_serializedAttributeWithTransparentTag
.
Parameters | |
wrapCallable[ | A 1-argument callable that wraps around the attribute's value so other tests can customize it. |
wrapCallable[ | A 1-argument callable that wraps around the outer tag so other tests can customize it. |
Common implementation of test_serializedAttributeWithTag
and test_serializedAttributeWithDeferredTag
.
Parameters | |
wrapTag and returning something flattenable | A 1-argument callable that wraps around the attribute's value so other tests can customize it. |
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[ | Undocumented |
See Also | |
http://www.w3.org/TR/REC-xml/#sec-comments |
Test that a coroutine returning an awaited deferred value is substituted with that value when flattened.
Like test_serializedAttributeWithTransparentTag
, but when the attribute is a provider of IRenderable
rather than a transparent tag.
Attribute values containing "<", ">", "&", or '"' have "<", ">", "&", or """ substituted for those bytes in the serialized output.
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.
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.
Attribute values which are supplied via the value of a t:transparent tag have the same substitution rules to them as values supplied directly.
Like test_serializedAttributeWithTransparentTag
, but when the attribute is rendered by a renderer on an element.
Like test_serializedAttributeWithSanitization
, but when the contents of the attribute are in a Deferred
.
Test that flattening a tag with a render attribute when no render factory is available in the context raises an exception.