aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/testing/yatest_lib
diff options
context:
space:
mode:
authorAleksandr <ivansduck@gmail.com>2022-02-10 16:47:52 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:52 +0300
commitea6c5b7f172becca389cacaff7d5f45f6adccbe6 (patch)
treed16cef493ac1e092b4a03ab9437ec06ffe3d188f /library/python/testing/yatest_lib
parent37de222addabbef336dcaaea5f7c7645a629fc6d (diff)
downloadydb-ea6c5b7f172becca389cacaff7d5f45f6adccbe6.tar.gz
Restoring authorship annotation for Aleksandr <ivansduck@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/python/testing/yatest_lib')
-rw-r--r--library/python/testing/yatest_lib/external.py36
-rw-r--r--library/python/testing/yatest_lib/test_splitter.py8
-rw-r--r--library/python/testing/yatest_lib/tests/test_external.py40
-rw-r--r--library/python/testing/yatest_lib/tests/ya.make6
-rw-r--r--library/python/testing/yatest_lib/ya.make14
5 files changed, 52 insertions, 52 deletions
diff --git a/library/python/testing/yatest_lib/external.py b/library/python/testing/yatest_lib/external.py
index 39113230d9..69874dece4 100644
--- a/library/python/testing/yatest_lib/external.py
+++ b/library/python/testing/yatest_lib/external.py
@@ -1,20 +1,20 @@
from __future__ import absolute_import
-import re
+import re
import sys
import copy
-import logging
+import logging
from . import tools
from datetime import date, datetime
-import enum
+import enum
import six
-logger = logging.getLogger(__name__)
-MDS_URI_PREFIX = 'https://storage.yandex-team.ru/get-devtools/'
-
+logger = logging.getLogger(__name__)
+MDS_URI_PREFIX = 'https://storage.yandex-team.ru/get-devtools/'
+
def apply(func, value, apply_to_keys=False):
"""
Applies func to every possible member of value
@@ -67,8 +67,8 @@ def serialize(value):
return val
if isinstance(val, six.string_types) or isinstance(val, bytes):
return tools.to_utf8(val)
- if isinstance(val, enum.Enum):
- return str(val)
+ if isinstance(val, enum.Enum):
+ return str(val)
if isinstance(val, six.integer_types) or type(val) in [float, bool]:
return val
if is_external(val):
@@ -136,19 +136,19 @@ class ExternalDataInfo(object):
@property
def path(self):
- if self.uri.count("://") != 1:
- logger.error("Invalid external data uri: '%s'", self.uri)
- return self.uri
+ if self.uri.count("://") != 1:
+ logger.error("Invalid external data uri: '%s'", self.uri)
+ return self.uri
_, path = self.uri.split("://")
return path
- def get_mds_key(self):
- assert self.is_http
- m = re.match(re.escape(MDS_URI_PREFIX) + r'(.*?)($|#)', self.uri)
- if m:
- return m.group(1)
- raise AssertionError("Failed to extract mds key properly from '{}'".format(self.uri))
-
+ def get_mds_key(self):
+ assert self.is_http
+ m = re.match(re.escape(MDS_URI_PREFIX) + r'(.*?)($|#)', self.uri)
+ if m:
+ return m.group(1)
+ raise AssertionError("Failed to extract mds key properly from '{}'".format(self.uri))
+
@property
def size(self):
return self._data.get("size")
diff --git a/library/python/testing/yatest_lib/test_splitter.py b/library/python/testing/yatest_lib/test_splitter.py
index acbcd4300e..bc7beba568 100644
--- a/library/python/testing/yatest_lib/test_splitter.py
+++ b/library/python/testing/yatest_lib/test_splitter.py
@@ -1,15 +1,15 @@
-# coding: utf-8
+# coding: utf-8
import collections
-def flatten_tests(test_classes):
+def flatten_tests(test_classes):
"""
>>> test_classes = {x: [x] for x in range(5)}
- >>> flatten_tests(test_classes)
+ >>> flatten_tests(test_classes)
[(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]
>>> test_classes = {x: [x + 1, x + 2] for x in range(2)}
- >>> flatten_tests(test_classes)
+ >>> flatten_tests(test_classes)
[(0, 1), (0, 2), (1, 2), (1, 3)]
"""
tests = []
diff --git a/library/python/testing/yatest_lib/tests/test_external.py b/library/python/testing/yatest_lib/tests/test_external.py
index 18cb560b17..ea5ebf97a3 100644
--- a/library/python/testing/yatest_lib/tests/test_external.py
+++ b/library/python/testing/yatest_lib/tests/test_external.py
@@ -1,20 +1,20 @@
-import enum
-import pytest
-
-from yatest_lib import external
-
-
-class MyEnum(enum.Enum):
- VAL1 = 1
- VAL2 = 2
-
-
-@pytest.mark.parametrize("data, expected_val, expected_type", [
- ({}, {}, dict),
- (MyEnum.VAL1, "MyEnum.VAL1", str),
- ({MyEnum.VAL1: MyEnum.VAL2}, {"MyEnum.VAL1": "MyEnum.VAL2"}, dict),
-])
-def test_serialize(data, expected_val, expected_type):
- data = external.serialize(data)
- assert expected_type == type(data), data
- assert expected_val == data
+import enum
+import pytest
+
+from yatest_lib import external
+
+
+class MyEnum(enum.Enum):
+ VAL1 = 1
+ VAL2 = 2
+
+
+@pytest.mark.parametrize("data, expected_val, expected_type", [
+ ({}, {}, dict),
+ (MyEnum.VAL1, "MyEnum.VAL1", str),
+ ({MyEnum.VAL1: MyEnum.VAL2}, {"MyEnum.VAL1": "MyEnum.VAL2"}, dict),
+])
+def test_serialize(data, expected_val, expected_type):
+ data = external.serialize(data)
+ assert expected_type == type(data), data
+ assert expected_val == data
diff --git a/library/python/testing/yatest_lib/tests/ya.make b/library/python/testing/yatest_lib/tests/ya.make
index 8586c6ef7d..89396b733e 100644
--- a/library/python/testing/yatest_lib/tests/ya.make
+++ b/library/python/testing/yatest_lib/tests/ya.make
@@ -1,13 +1,13 @@
-OWNER(g:yatest)
+OWNER(g:yatest)
-PY23_TEST()
+PY23_TEST()
PEERDIR(
library/python/testing/yatest_lib
)
TEST_SRCS(
- test_external.py
+ test_external.py
test_testsplitter.py
)
diff --git a/library/python/testing/yatest_lib/ya.make b/library/python/testing/yatest_lib/ya.make
index 342bae82ba..1b9d7aa8c2 100644
--- a/library/python/testing/yatest_lib/ya.make
+++ b/library/python/testing/yatest_lib/ya.make
@@ -1,4 +1,4 @@
-OWNER(g:yatest)
+OWNER(g:yatest)
PY23_LIBRARY()
@@ -15,12 +15,12 @@ PEERDIR(
contrib/python/six
)
-IF(PYTHON2)
- PEERDIR(
- contrib/python/enum34
- )
-ENDIF()
-
+IF(PYTHON2)
+ PEERDIR(
+ contrib/python/enum34
+ )
+ENDIF()
+
END()
RECURSE_FOR_TESTS(tests)