diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/jmespath/tests/__init__.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/jmespath/tests/__init__.py')
-rw-r--r-- | contrib/python/jmespath/tests/__init__.py | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/contrib/python/jmespath/tests/__init__.py b/contrib/python/jmespath/tests/__init__.py index d86946ccda..7dd0ef61bd 100644 --- a/contrib/python/jmespath/tests/__init__.py +++ b/contrib/python/jmespath/tests/__init__.py @@ -1,40 +1,40 @@ -import sys -from jmespath import ast - - -# The unittest module got a significant overhaul -# in 2.7, so if we're in 2.6 we can use the backported -# version unittest2. -if sys.version_info[:2] == (2, 6): - import unittest2 as unittest - import simplejson as json - from ordereddict import OrderedDict -else: - import unittest - import json - from collections import OrderedDict - - -# Helper method used to create an s-expression -# of the AST to make unit test assertions easier. -# You get a nice string diff on assert failures. -def as_s_expression(node): - parts = [] - _as_s_expression(node, parts) - return ''.join(parts) - - -def _as_s_expression(node, parts): - parts.append("(%s" % (node.__class__.__name__.lower())) - if isinstance(node, ast.Field): - parts.append(" %s" % node.name) - elif isinstance(node, ast.FunctionExpression): - parts.append(" %s" % node.name) - elif isinstance(node, ast.KeyValPair): - parts.append(" %s" % node.key_name) - for child in node.children: - parts.append(" ") - _as_s_expression(child, parts) - parts.append(")") - - +import sys +from jmespath import ast + + +# The unittest module got a significant overhaul +# in 2.7, so if we're in 2.6 we can use the backported +# version unittest2. +if sys.version_info[:2] == (2, 6): + import unittest2 as unittest + import simplejson as json + from ordereddict import OrderedDict +else: + import unittest + import json + from collections import OrderedDict + + +# Helper method used to create an s-expression +# of the AST to make unit test assertions easier. +# You get a nice string diff on assert failures. +def as_s_expression(node): + parts = [] + _as_s_expression(node, parts) + return ''.join(parts) + + +def _as_s_expression(node, parts): + parts.append("(%s" % (node.__class__.__name__.lower())) + if isinstance(node, ast.Field): + parts.append(" %s" % node.name) + elif isinstance(node, ast.FunctionExpression): + parts.append(" %s" % node.name) + elif isinstance(node, ast.KeyValPair): + parts.append(" %s" % node.key_name) + for child in node.children: + parts.append(" ") + _as_s_expression(child, parts) + parts.append(")") + + |