Perform a sanity check on the environment.
(environment: "Environment")
| 122 | |
| 123 | |
| 124 | def _environment_config_check(environment: "Environment") -> "Environment": |
| 125 | """Perform a sanity check on the environment.""" |
| 126 | assert issubclass( |
| 127 | environment.undefined, Undefined |
| 128 | ), "'undefined' must be a subclass of 'jinja2.Undefined'." |
| 129 | assert ( |
| 130 | environment.block_start_string |
| 131 | != environment.variable_start_string |
| 132 | != environment.comment_start_string |
| 133 | ), "block, variable and comment start strings must be different." |
| 134 | assert environment.newline_sequence in { |
| 135 | "\r", |
| 136 | "\r\n", |
| 137 | "\n", |
| 138 | }, "'newline_sequence' must be one of '\\n', '\\r\\n', or '\\r'." |
| 139 | return environment |
| 140 | |
| 141 | |
| 142 | class Environment: |