-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for docstring with escape characters (#416)
We test explicitly what happens with special characters which are represented as literals in docstrings in the intermediate stage. See [this StackOverflow question] for the background. [this StackOverflow question]: https://stackoverflow.com/questions/57265111/escape-special-characters-in-restructuredtext-sphinx
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...ata/intermediate/expected/documentation/docstring_as_raw_string/expected_symbol_table.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
SymbolTable( | ||
our_types=[ | ||
ConstrainedPrimitive( | ||
name='Non_empty_XML_serializable_string', | ||
inheritances=[], | ||
inheritance_id_set=..., | ||
ancestors=[], | ||
ancestor_id_set=..., | ||
descendant_id_set=..., | ||
constrainee='STR', | ||
is_implementation_specific=False, | ||
invariants=[], | ||
invariant_id_set=..., | ||
description=DescriptionOfOurType( | ||
summary='<paragraph>Represent a string with at least one character.</paragraph>', | ||
remarks=[ | ||
textwrap.dedent("""\ | ||
<paragraph>The string should also be serializable to XML, which is the background for | ||
the following constraint.</paragraph>""")], | ||
constraints_by_identifier=[ | ||
[ | ||
'AASd-130', | ||
textwrap.dedent("""\ | ||
<field_body><paragraph>An attribute with data type "string" shall consist of these characters only: | ||
<literal>^[\\x09\\x0A\\x0D\\x20-\\uD7FF\\uE000-\\uFFFD\\u00010000-\\u0010FFFF]*$</literal>.</paragraph></field_body>""")]], | ||
parsed=...), | ||
parsed=...)], | ||
our_types_topologically_sorted=[ | ||
'Reference to our type Non_empty_XML_serializable_string'], | ||
enumerations=[], | ||
constrained_primitives=[ | ||
'Reference to our type Non_empty_XML_serializable_string'], | ||
classes=[], | ||
concrete_classes=[], | ||
constants=[], | ||
constants_by_name=..., | ||
verification_functions=[], | ||
verification_functions_by_name=..., | ||
meta_model=MetaModel( | ||
description=None, | ||
version='dummy', | ||
xml_namespace='https://dummy.com')) |
20 changes: 20 additions & 0 deletions
20
test_data/intermediate/expected/documentation/docstring_as_raw_string/meta_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# We test for ``\x09`` and other special characters, and make sure they are represented | ||
# adequately in the string dump of the symbol table. | ||
|
||
|
||
class Non_empty_XML_serializable_string(str, DBC): | ||
r""" | ||
Represent a string with at least one character. | ||
The string should also be serializable to XML, which is the background for | ||
the following constraint. | ||
:constraint AASd-130: | ||
An attribute with data type "string" shall consist of these characters only: | ||
``^[\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u00010000-\u0010FFFF]*$``. | ||
""" | ||
|
||
|
||
__version__ = "dummy" | ||
__xml_namespace__ = "https://dummy.com" |
Binary file modified
BIN
+29.2 KB
(100%)
test_data/intermediate/real_meta_models/aas_core_meta.v3/expected_symbol_table.txt
Binary file not shown.