summaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py
diff options
context:
space:
mode:
authoralexv-smirnov <[email protected]>2023-03-28 22:25:04 +0300
committeralexv-smirnov <[email protected]>2023-03-28 22:25:04 +0300
commitb8a17f9b1c166d2e9a26b99348a4c29d972caf55 (patch)
tree1a2d881f1a9452b9c6103dbf69d73da7624e98e5 /contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py
parent25659221f18577ea38430a8ec3349836f5626b6a (diff)
Revert ymake build from ydb oss export
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py')
-rw-r--r--contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py101
1 files changed, 0 insertions, 101 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py b/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py
deleted file mode 100644
index 3d1906ca0b4..00000000000
--- a/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py
+++ /dev/null
@@ -1,101 +0,0 @@
-import unittest
-
-from Cython.Compiler import Code, UtilityCode
-
-
-def strip_2tup(tup):
- return tup[0] and tup[0].strip(), tup[1] and tup[1].strip()
-
-class TestUtilityLoader(unittest.TestCase):
- """
- Test loading UtilityCodes
- """
-
- expected = "test {{loader}} prototype", "test {{loader}} impl"
-
- required = "req {{loader}} proto", "req {{loader}} impl"
-
- context = dict(loader='Loader')
-
- name = "TestUtilityLoader"
- filename = "TestUtilityLoader.c"
- cls = Code.UtilityCode
-
- def test_load_as_string(self):
- got = strip_2tup(self.cls.load_as_string(self.name))
- self.assertEqual(got, self.expected)
-
- got = strip_2tup(self.cls.load_as_string(self.name, self.filename))
- self.assertEqual(got, self.expected)
-
- def test_load(self):
- utility = self.cls.load(self.name)
- got = strip_2tup((utility.proto, utility.impl))
- self.assertEqual(got, self.expected)
-
- required, = utility.requires
- got = strip_2tup((required.proto, required.impl))
- self.assertEqual(got, self.required)
-
- utility = self.cls.load(self.name, from_file=self.filename)
- got = strip_2tup((utility.proto, utility.impl))
- self.assertEqual(got, self.expected)
-
- utility = self.cls.load_cached(self.name, from_file=self.filename)
- got = strip_2tup((utility.proto, utility.impl))
- self.assertEqual(got, self.expected)
-
-
-class TestTempitaUtilityLoader(TestUtilityLoader):
- """
- Test loading UtilityCodes with Tempita substitution
- """
- expected_tempita = (TestUtilityLoader.expected[0].replace('{{loader}}', 'Loader'),
- TestUtilityLoader.expected[1].replace('{{loader}}', 'Loader'))
-
- required_tempita = (TestUtilityLoader.required[0].replace('{{loader}}', 'Loader'),
- TestUtilityLoader.required[1].replace('{{loader}}', 'Loader'))
-
- cls = Code.TempitaUtilityCode
-
- def test_load_as_string(self):
- got = strip_2tup(self.cls.load_as_string(self.name, context=self.context))
- self.assertEqual(got, self.expected_tempita)
-
- def test_load(self):
- utility = self.cls.load(self.name, context=self.context)
- got = strip_2tup((utility.proto, utility.impl))
- self.assertEqual(got, self.expected_tempita)
-
- required, = utility.requires
- got = strip_2tup((required.proto, required.impl))
- self.assertEqual(got, self.required_tempita)
-
- utility = self.cls.load(self.name, from_file=self.filename, context=self.context)
- got = strip_2tup((utility.proto, utility.impl))
- self.assertEqual(got, self.expected_tempita)
-
-
-class TestCythonUtilityLoader(TestTempitaUtilityLoader):
- """
- Test loading CythonUtilityCodes
- """
-
- # Just change the attributes and run the same tests
- expected = None, "test {{cy_loader}} impl"
- expected_tempita = None, "test CyLoader impl"
-
- required = None, "req {{cy_loader}} impl"
- required_tempita = None, "req CyLoader impl"
-
- context = dict(cy_loader='CyLoader')
-
- name = "TestCyUtilityLoader"
- filename = "TestCyUtilityLoader.pyx"
- cls = UtilityCode.CythonUtilityCode
-
- # Small hack to pass our tests above
- cls.proto = None
-
- test_load = TestUtilityLoader.test_load
- test_load_tempita = TestTempitaUtilityLoader.test_load