diff options
author | Alex Tomkins <tomkins@darkzone.net> | 2016-11-13 23:10:24 +0000 |
---|---|---|
committer | Alex Tomkins <tomkins@darkzone.net> | 2016-12-04 23:15:37 +0000 |
commit | 1c565fb472c07dffcf95f925b647f17f3e86aa43 (patch) | |
tree | 4cee65eafb4a9337fe4dff00dfb778a5916e11c6 | |
parent | 7f611e99d36089bc6836042ba8aec2df02a56f3a (diff) | |
download | pymemcache-1c565fb472c07dffcf95f925b647f17f3e86aa43.tar.gz |
Add test for subclasses of builtin types
-rw-r--r-- | pymemcache/test/test_serde.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pymemcache/test/test_serde.py b/pymemcache/test/test_serde.py index 26c27d1..d003482 100644 --- a/pymemcache/test/test_serde.py +++ b/pymemcache/test/test_serde.py @@ -7,6 +7,16 @@ import pytest import six +class CustomInt(int): + """ + Custom integer type for testing. + + Entirely useless, but used to show that built in types get serialized and + deserialized back as the same type of object. + """ + pass + + @pytest.mark.unit() class TestSerde(TestCase): @@ -42,3 +52,7 @@ class TestSerde(TestCase): def test_pickleable(self): self.check({'a': 'dict'}, FLAG_PICKLE) + + def test_subtype(self): + # Subclass of a native type will be restored as the same type + self.check(CustomInt(123123), FLAG_PICKLE) |