aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Compiler/Tests
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/cython/Cython/Compiler/Tests
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/Tests')
-rw-r--r--contrib/tools/cython/Cython/Compiler/Tests/TestBuffer.py22
-rw-r--r--contrib/tools/cython/Cython/Compiler/Tests/TestMemView.py2
-rw-r--r--contrib/tools/cython/Cython/Compiler/Tests/TestParseTreeTransforms.py2
-rw-r--r--contrib/tools/cython/Cython/Compiler/Tests/TestStringEncoding.py88
-rw-r--r--contrib/tools/cython/Cython/Compiler/Tests/TestTreeFragment.py10
5 files changed, 62 insertions, 62 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestBuffer.py b/contrib/tools/cython/Cython/Compiler/Tests/TestBuffer.py
index 45f8c6b74f..1f69d96524 100644
--- a/contrib/tools/cython/Cython/Compiler/Tests/TestBuffer.py
+++ b/contrib/tools/cython/Cython/Compiler/Tests/TestBuffer.py
@@ -21,7 +21,7 @@ class TestBufferParsing(CythonTest):
def test_basic(self):
t = self.parse(u"cdef object[float, 4, ndim=2, foo=foo] x")
bufnode = t.stats[0].base_type
- self.assertTrue(isinstance(bufnode, TemplatedTypeNode))
+ self.assertTrue(isinstance(bufnode, TemplatedTypeNode))
self.assertEqual(2, len(bufnode.positional_args))
# print bufnode.dump()
# should put more here...
@@ -46,7 +46,7 @@ class TestBufferOptions(CythonTest):
def nonfatal_error(self, error):
# We're passing self as context to transform to trap this
self.error = error
- self.assertTrue(self.expect_error)
+ self.assertTrue(self.expect_error)
def parse_opts(self, opts, expect_error=False):
assert opts != ""
@@ -57,12 +57,12 @@ class TestBufferOptions(CythonTest):
vardef = root.stats[0].body.stats[0]
assert isinstance(vardef, CVarDefNode) # use normal assert as this is to validate the test code
buftype = vardef.base_type
- self.assertTrue(isinstance(buftype, TemplatedTypeNode))
- self.assertTrue(isinstance(buftype.base_type_node, CSimpleBaseTypeNode))
+ self.assertTrue(isinstance(buftype, TemplatedTypeNode))
+ self.assertTrue(isinstance(buftype.base_type_node, CSimpleBaseTypeNode))
self.assertEqual(u"object", buftype.base_type_node.name)
return buftype
else:
- self.assertTrue(len(root.stats[0].body.stats) == 0)
+ self.assertTrue(len(root.stats[0].body.stats) == 0)
def non_parse(self, expected_err, opts):
self.parse_opts(opts, expect_error=True)
@@ -71,14 +71,14 @@ class TestBufferOptions(CythonTest):
def __test_basic(self):
buf = self.parse_opts(u"unsigned short int, 3")
- self.assertTrue(isinstance(buf.dtype_node, CSimpleBaseTypeNode))
- self.assertTrue(buf.dtype_node.signed == 0 and buf.dtype_node.longness == -1)
+ self.assertTrue(isinstance(buf.dtype_node, CSimpleBaseTypeNode))
+ self.assertTrue(buf.dtype_node.signed == 0 and buf.dtype_node.longness == -1)
self.assertEqual(3, buf.ndim)
def __test_dict(self):
buf = self.parse_opts(u"ndim=3, dtype=unsigned short int")
- self.assertTrue(isinstance(buf.dtype_node, CSimpleBaseTypeNode))
- self.assertTrue(buf.dtype_node.signed == 0 and buf.dtype_node.longness == -1)
+ self.assertTrue(isinstance(buf.dtype_node, CSimpleBaseTypeNode))
+ self.assertTrue(buf.dtype_node.signed == 0 and buf.dtype_node.longness == -1)
self.assertEqual(3, buf.ndim)
def __test_ndim(self):
@@ -94,8 +94,8 @@ class TestBufferOptions(CythonTest):
cdef object[ndim=ndim, dtype=int] y
""", pipeline=[NormalizeTree(self), PostParse(self)]).root
stats = t.stats[0].body.stats
- self.assertTrue(stats[0].base_type.ndim == 3)
- self.assertTrue(stats[1].base_type.ndim == 3)
+ self.assertTrue(stats[0].base_type.ndim == 3)
+ self.assertTrue(stats[1].base_type.ndim == 3)
# add exotic and impossible combinations as they come along...
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestMemView.py b/contrib/tools/cython/Cython/Compiler/Tests/TestMemView.py
index 237943d217..3792f26e99 100644
--- a/contrib/tools/cython/Cython/Compiler/Tests/TestMemView.py
+++ b/contrib/tools/cython/Cython/Compiler/Tests/TestMemView.py
@@ -48,7 +48,7 @@ class TestMemviewParsing(CythonTest):
def test_basic(self):
t = self.parse(u"cdef int[:] x")
memv_node = t.stats[0].base_type
- self.assertTrue(isinstance(memv_node, MemoryViewSliceTypeNode))
+ self.assertTrue(isinstance(memv_node, MemoryViewSliceTypeNode))
# we also test other similar declarations (buffers, anonymous C arrays)
# since the parsing has to distinguish between them.
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestParseTreeTransforms.py b/contrib/tools/cython/Cython/Compiler/Tests/TestParseTreeTransforms.py
index 5917605ae1..234b45db5b 100644
--- a/contrib/tools/cython/Cython/Compiler/Tests/TestParseTreeTransforms.py
+++ b/contrib/tools/cython/Cython/Compiler/Tests/TestParseTreeTransforms.py
@@ -87,7 +87,7 @@ class TestNormalizeTree(TransformTest):
def test_pass_eliminated(self):
t = self.run_pipeline([NormalizeTree(None)], u"pass")
- self.assertTrue(len(t.stats) == 0)
+ self.assertTrue(len(t.stats) == 0)
class TestWithTransform(object): # (TransformTest): # Disabled!
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestStringEncoding.py b/contrib/tools/cython/Cython/Compiler/Tests/TestStringEncoding.py
index de79469cfb..91d099333a 100644
--- a/contrib/tools/cython/Cython/Compiler/Tests/TestStringEncoding.py
+++ b/contrib/tools/cython/Cython/Compiler/Tests/TestStringEncoding.py
@@ -1,44 +1,44 @@
-# -*- coding: utf-8 -*-
-
-import sys
-import unittest
-
-import Cython.Compiler.StringEncoding as StringEncoding
-
-
-class StringEncodingTest(unittest.TestCase):
- """
- Test the StringEncoding module.
- """
- def test_string_contains_lone_surrogates(self):
- self.assertFalse(StringEncoding.string_contains_lone_surrogates(u"abc"))
- self.assertFalse(StringEncoding.string_contains_lone_surrogates(u"\uABCD"))
- self.assertFalse(StringEncoding.string_contains_lone_surrogates(u"\N{SNOWMAN}"))
-
- # This behaves differently in Py2 when freshly parsed and read from a .pyc file,
- # but it seems to be a marshalling bug in Py2, which doesn't hurt us in Cython.
- if sys.version_info[0] != 2:
- self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uD800\uDFFF"))
-
- # In Py2 with 16bit Unicode, the following is indistinguishable from the 32bit character.
- obfuscated_surrogate_pair = (u"\uDFFF" + "\uD800")[::-1]
- if sys.version_info[0] == 2 and sys.maxunicode == 65565:
- self.assertFalse(StringEncoding.string_contains_lone_surrogates(obfuscated_surrogate_pair))
- else:
- self.assertTrue(StringEncoding.string_contains_lone_surrogates(obfuscated_surrogate_pair))
-
- self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uD800"))
- self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uDFFF"))
- self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uDFFF\uD800"))
- self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uD800x\uDFFF"))
-
- def test_string_contains_surrogates(self):
- self.assertFalse(StringEncoding.string_contains_surrogates(u"abc"))
- self.assertFalse(StringEncoding.string_contains_surrogates(u"\uABCD"))
- self.assertFalse(StringEncoding.string_contains_surrogates(u"\N{SNOWMAN}"))
-
- self.assertTrue(StringEncoding.string_contains_surrogates(u"\uD800"))
- self.assertTrue(StringEncoding.string_contains_surrogates(u"\uDFFF"))
- self.assertTrue(StringEncoding.string_contains_surrogates(u"\uD800\uDFFF"))
- self.assertTrue(StringEncoding.string_contains_surrogates(u"\uDFFF\uD800"))
- self.assertTrue(StringEncoding.string_contains_surrogates(u"\uD800x\uDFFF"))
+# -*- coding: utf-8 -*-
+
+import sys
+import unittest
+
+import Cython.Compiler.StringEncoding as StringEncoding
+
+
+class StringEncodingTest(unittest.TestCase):
+ """
+ Test the StringEncoding module.
+ """
+ def test_string_contains_lone_surrogates(self):
+ self.assertFalse(StringEncoding.string_contains_lone_surrogates(u"abc"))
+ self.assertFalse(StringEncoding.string_contains_lone_surrogates(u"\uABCD"))
+ self.assertFalse(StringEncoding.string_contains_lone_surrogates(u"\N{SNOWMAN}"))
+
+ # This behaves differently in Py2 when freshly parsed and read from a .pyc file,
+ # but it seems to be a marshalling bug in Py2, which doesn't hurt us in Cython.
+ if sys.version_info[0] != 2:
+ self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uD800\uDFFF"))
+
+ # In Py2 with 16bit Unicode, the following is indistinguishable from the 32bit character.
+ obfuscated_surrogate_pair = (u"\uDFFF" + "\uD800")[::-1]
+ if sys.version_info[0] == 2 and sys.maxunicode == 65565:
+ self.assertFalse(StringEncoding.string_contains_lone_surrogates(obfuscated_surrogate_pair))
+ else:
+ self.assertTrue(StringEncoding.string_contains_lone_surrogates(obfuscated_surrogate_pair))
+
+ self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uD800"))
+ self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uDFFF"))
+ self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uDFFF\uD800"))
+ self.assertTrue(StringEncoding.string_contains_lone_surrogates(u"\uD800x\uDFFF"))
+
+ def test_string_contains_surrogates(self):
+ self.assertFalse(StringEncoding.string_contains_surrogates(u"abc"))
+ self.assertFalse(StringEncoding.string_contains_surrogates(u"\uABCD"))
+ self.assertFalse(StringEncoding.string_contains_surrogates(u"\N{SNOWMAN}"))
+
+ self.assertTrue(StringEncoding.string_contains_surrogates(u"\uD800"))
+ self.assertTrue(StringEncoding.string_contains_surrogates(u"\uDFFF"))
+ self.assertTrue(StringEncoding.string_contains_surrogates(u"\uD800\uDFFF"))
+ self.assertTrue(StringEncoding.string_contains_surrogates(u"\uDFFF\uD800"))
+ self.assertTrue(StringEncoding.string_contains_surrogates(u"\uD800x\uDFFF"))
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestTreeFragment.py b/contrib/tools/cython/Cython/Compiler/Tests/TestTreeFragment.py
index 7f5a91bccf..9ee8da5478 100644
--- a/contrib/tools/cython/Cython/Compiler/Tests/TestTreeFragment.py
+++ b/contrib/tools/cython/Cython/Compiler/Tests/TestTreeFragment.py
@@ -23,7 +23,7 @@ class TestTreeFragments(CythonTest):
T = self.fragment(u"y + y").substitute({"y": NameNode(pos=None, name="x")})
self.assertEqual("x", T.stats[0].expr.operand1.name)
self.assertEqual("x", T.stats[0].expr.operand2.name)
- self.assertTrue(T.stats[0].expr.operand1 is not T.stats[0].expr.operand2)
+ self.assertTrue(T.stats[0].expr.operand1 is not T.stats[0].expr.operand2)
def test_substitution(self):
F = self.fragment(u"x = 4")
@@ -35,7 +35,7 @@ class TestTreeFragments(CythonTest):
F = self.fragment(u"PASS")
pass_stat = PassStatNode(pos=None)
T = F.substitute({"PASS" : pass_stat})
- self.assertTrue(isinstance(T.stats[0], PassStatNode), T)
+ self.assertTrue(isinstance(T.stats[0], PassStatNode), T)
def test_pos_is_transferred(self):
F = self.fragment(u"""
@@ -55,9 +55,9 @@ class TestTreeFragments(CythonTest):
""")
T = F.substitute(temps=[u"TMP"])
s = T.body.stats
- self.assertTrue(isinstance(s[0].expr, TempRefNode))
- self.assertTrue(isinstance(s[1].rhs, TempRefNode))
- self.assertTrue(s[0].expr.handle is s[1].rhs.handle)
+ self.assertTrue(isinstance(s[0].expr, TempRefNode))
+ self.assertTrue(isinstance(s[1].rhs, TempRefNode))
+ self.assertTrue(s[0].expr.handle is s[1].rhs.handle)
if __name__ == "__main__":
import unittest