__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import ast
class ASTTestMixin:
"""Test mixing to have basic assertions for AST nodes."""
def assertASTEqual(self, ast1, ast2):
# Ensure the comparisons start at an AST node
self.assertIsInstance(ast1, ast.AST)
self.assertIsInstance(ast2, ast.AST)
# An AST comparison routine modeled after ast.dump(), but
# instead of string building, it traverses the two trees
# in lock-step.
def traverse_compare(a, b, missing=object()):
if type(a) is not type(b):
self.fail(f"{type(a)!r} is not {type(b)!r}")
if isinstance(a, ast.AST):
for field in a._fields:
value1 = getattr(a, field, missing)
value2 = getattr(b, field, missing)
# Singletons are equal by definition, so further
# testing can be skipped.
if value1 is not value2:
traverse_compare(value1, value2)
elif isinstance(a, list):
try:
for node1, node2 in zip(a, b, strict=True):
traverse_compare(node1, node2)
except ValueError:
# Attempt a "pretty" error ala assertSequenceEqual()
len1 = len(a)
len2 = len(b)
if len1 > len2:
what = "First"
diff = len1 - len2
else:
what = "Second"
diff = len2 - len1
msg = f"{what} list contains {diff} additional elements."
raise self.failureException(msg) from None
elif a != b:
self.fail(f"{a!r} != {b!r}")
traverse_compare(ast1, ast2)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| _hypothesis_stubs | Folder | 0755 |
|
|
| __init__.py | File | 78.13 KB | 0644 |
|
| ast_helper.py | File | 1.79 KB | 0644 |
|
| asynchat.py | File | 11.33 KB | 0644 |
|
| asyncore.py | File | 19.9 KB | 0644 |
|
| bytecode_helper.py | File | 4.88 KB | 0644 |
|
| hashlib_helper.py | File | 1.86 KB | 0644 |
|
| hypothesis_helper.py | File | 1.35 KB | 0644 |
|
| import_helper.py | File | 10.48 KB | 0644 |
|
| interpreters.py | File | 5.67 KB | 0644 |
|
| logging_helper.py | File | 916 B | 0644 |
|
| os_helper.py | File | 23.72 KB | 0644 |
|
| pty_helper.py | File | 2.98 KB | 0644 |
|
| script_helper.py | File | 11.45 KB | 0644 |
|
| smtpd.py | File | 30.01 KB | 0755 |
|
| socket_helper.py | File | 13.47 KB | 0644 |
|
| testcase.py | File | 1.02 KB | 0644 |
|
| threading_helper.py | File | 7.86 KB | 0644 |
|
| warnings_helper.py | File | 6.69 KB | 0644 |
|