diff options
author | nik-bes <[email protected]> | 2025-05-19 07:20:13 +0300 |
---|---|---|
committer | nik-bes <[email protected]> | 2025-05-19 07:36:02 +0300 |
commit | 317b7368e24941ff76499f500579fd9b10f6656e (patch) | |
tree | abbcbaea595e7d2e9f23cf59a408b3082fe4340d /contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py | |
parent | 6b666a52d40308ab9b3532cd8d3008b9f37cfffb (diff) |
Update Cython to 3.0.10.
commit_hash:b43c96b868cd36d636192fd2c6024d9f0d2fb6f8
Diffstat (limited to 'contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py')
-rw-r--r-- | contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py b/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py index 3d1906ca0b4..98a3853819f 100644 --- a/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py +++ b/contrib/tools/cython/Cython/Compiler/Tests/TestUtilityLoad.py @@ -22,14 +22,11 @@ class TestUtilityLoader(unittest.TestCase): 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) + utility = self.cls.load(self.name, from_file=self.filename) got = strip_2tup((utility.proto, utility.impl)) self.assertEqual(got, self.expected) @@ -37,10 +34,6 @@ class TestUtilityLoader(unittest.TestCase): 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) @@ -59,11 +52,11 @@ class TestTempitaUtilityLoader(TestUtilityLoader): cls = Code.TempitaUtilityCode def test_load_as_string(self): - got = strip_2tup(self.cls.load_as_string(self.name, context=self.context)) + got = strip_2tup(self.cls.load_as_string(self.name, self.filename, context=self.context)) self.assertEqual(got, self.expected_tempita) def test_load(self): - utility = self.cls.load(self.name, context=self.context) + utility = self.cls.load(self.name, self.filename, context=self.context) got = strip_2tup((utility.proto, utility.impl)) self.assertEqual(got, self.expected_tempita) @@ -99,3 +92,21 @@ class TestCythonUtilityLoader(TestTempitaUtilityLoader): test_load = TestUtilityLoader.test_load test_load_tempita = TestTempitaUtilityLoader.test_load + + +class TestUtilityCode(unittest.TestCase): + def test_equality(self): + c1 = Code.UtilityCode.load("NumpyImportUFunc", "NumpyImportArray.c") + c2 = Code.UtilityCode.load("NumpyImportArray", "NumpyImportArray.c") + c3 = Code.UtilityCode.load("pyunicode_strlen", "StringTools.c") + c4 = Code.UtilityCode.load("pyunicode_from_unicode", "StringTools.c") + c5 = Code.UtilityCode.load("IncludeStringH", "StringTools.c") + c6 = Code.UtilityCode.load("IncludeCppStringH", "StringTools.c") + + codes = [c1, c2, c3, c4, c5, c6] + for m in range(len(codes)): + for n in range(len(codes)): + if n == m: + self.assertEqual(codes[m], codes[n]) + else: + self.assertNotEqual(codes[m], codes[n]) |