Create a new formatting context. The format context is used for when an explanation wants to have a variable value formatted in the assertion message. In this case the value required can be added using .explanation_param(). Finally .pop_format_context() is used
(self)
| 804 | return "%(" + specifier + ")s" |
| 805 | |
| 806 | def push_format_context(self) -> None: |
| 807 | """Create a new formatting context. |
| 808 | |
| 809 | The format context is used for when an explanation wants to |
| 810 | have a variable value formatted in the assertion message. In |
| 811 | this case the value required can be added using |
| 812 | .explanation_param(). Finally .pop_format_context() is used |
| 813 | to format a string of %-formatted values as added by |
| 814 | .explanation_param(). |
| 815 | """ |
| 816 | self.explanation_specifiers: dict[str, ast.expr] = {} |
| 817 | self.stack.append(self.explanation_specifiers) |
| 818 | |
| 819 | def pop_format_context(self, expl_expr: ast.expr) -> ast.Name: |
| 820 | """Format the %-formatted string with current format context. |
no test coverage detected