File: //snap/certbot/current/lib64/python3.12/site-packages/pyparsing/__pycache__/testing.cpython-312.pyc
�
Ȗ0iq; � �P � d dl mZ d dlZd dlZddlmZmZmZmZm Z G d� d� Z
y)� )�contextmanagerN� )�
ParserElement�ParseException�Keyword�__diag__�
__compat__c � � e Zd ZdZ G d� d� Z G d� d� Ze dddd �d
edej e
dej e
d
ededej e dej e dej ee
f dedefd�� Z
y)�pyparsing_testzB
namespace class for classes useful in writing unit tests
c �4 � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z y) �&pyparsing_test.reset_pyparsing_contexta?
Context manager to be used when writing unit tests that modify pyparsing config values:
- packrat parsing
- bounded recursion parsing
- default whitespace characters
- default keyword characters
- literal string auto-conversion class
- ``__diag__`` settings
Example:
.. testcode::
ppt = pyparsing.pyparsing_test
class MyTestClass(ppt.TestParseResultsAsserts):
def test_literal(self):
with ppt.reset_pyparsing_context():
# test that literals used to construct
# a grammar are automatically suppressed
ParserElement.inline_literals_using(Suppress)
term = Word(alphas) | Word(nums)
group = Group('(' + term[...] + ')')
# assert that the '()' characters
# are not included in the parsed tokens
self.assertParseAndCheckList(
group,
"(abc 123 def)",
['abc', '123', 'def']
)
# after exiting context manager, literals
# are converted to Literal expressions again
c � � i | _ y �N)�
_save_context��selfs ��/build/snapcraft-certbot-3159324ea1206d36e7f0992193f2ac71/parts/certbot/install/lib/python3.12/site-packages/pyparsing/testing.py�__init__z/pyparsing_test.reset_pyparsing_context.__init__<