diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-01-01 16:09:01 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2021-12-17 21:29:05 +0100 |
commit | 76fa211620de167b76846f0e5db5b64b8756ad48 (patch) | |
tree | c435dbf6585b3758dc78ee82bf114e162a25d0e1 /test/base/test_result.py | |
parent | 3543fcc9c9601e81560d055ceadaea05c75815c0 (diff) | |
download | sqlalchemy-workflow_test_cython.tar.gz |
Replace c extension with cython versions.workflow_test_cython
Re-implement c version immutabledict / processors / resultproxy / utils with cython.
Performance is in general in par or better than the c version
Added a collection module that has cython version of OrderedSet and IdentitySet
Added a new test/perf file to compare the implementations.
Run ``python test/perf/compiled_extensions.py all`` to execute the comparison test.
See results here: https://docs.google.com/document/d/1nOcDGojHRtXEkuy4vNXcW_XOJd9gqKhSeALGG3kYr6A/edit?usp=sharing
Fixes: #7256
Change-Id: I2930ef1894b5048210384728118e586e813f6a76
Signed-off-by: Federico Caselli <cfederico87@gmail.com>
Diffstat (limited to 'test/base/test_result.py')
-rw-r--r-- | test/base/test_result.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/base/test_result.py b/test/base/test_result.py index 8c9eb398e..b31e886da 100644 --- a/test/base/test_result.py +++ b/test/base/test_result.py @@ -195,6 +195,37 @@ class ResultTupleTest(fixtures.TestBase): eq_(kt._fields, ("a", "b")) eq_(kt._asdict(), {"a": 1, "b": 3}) + @testing.requires.cextensions + def test_serialize_cy_py_cy(self): + from sqlalchemy.engine._py_row import BaseRow as _PyRow + from sqlalchemy.cyextension.resultproxy import BaseRow as _CyRow + + global Row + + p = result.SimpleResultMetaData(["a", None, "b"]) + + for loads, dumps in picklers(): + + class Row(_CyRow): + pass + + row = Row(p, p._processors, p._keymap, 0, (1, 2, 3)) + + state = dumps(row) + + class Row(_PyRow): + pass + + row2 = loads(state) + is_true(isinstance(row2, _PyRow)) + state2 = dumps(row2) + + class Row(_CyRow): + pass + + row3 = loads(state2) + is_true(isinstance(row3, _CyRow)) + class ResultTest(fixtures.TestBase): def _fixture( |