]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
test name pickling
authorBob Halley <halley@dnspython.org>
Fri, 14 Aug 2020 00:29:42 +0000 (17:29 -0700)
committerBob Halley <halley@dnspython.org>
Fri, 14 Aug 2020 00:29:42 +0000 (17:29 -0700)
tests/test_name.py

index afa7d5de95e2f66b823070e4dc94ebba9b9af463..f91d7e65a5dbc15da0bbeff5462efff59897b49d 100644 (file)
@@ -19,6 +19,7 @@
 from typing import Dict # pylint: disable=unused-import
 import copy
 import operator
+import pickle
 import unittest
 
 from io import BytesIO
@@ -1079,5 +1080,11 @@ class NameTestCase(unittest.TestCase):
         n = dns.name.from_unicode('Königsgäßchen;\ttext')
         self.assertEqual(n.to_unicode(), 'königsgässchen\\;\\009text.')
 
+    def test_pickle(self):
+        n1 = dns.name.from_text('foo.example')
+        p = pickle.dumps(n1)
+        n2 = pickle.loads(p)
+        self.assertEqual(n1, n2)
+
 if __name__ == '__main__':
     unittest.main()