Commit 20f6d7b7 authored by Denis Bilenko's avatar Denis Bilenko

add test__ares_host_result.py with test for issue 104

parent bd436751
import pickle
import unittest
from gevent.ares import ares_host_result
class TestPickle(unittest.TestCase):
# Issue 104: ares.ares_host_result unpickleable
def _test(self, protocol):
r = ares_host_result('family', ('arg1', 'arg2', ))
dumped = pickle.dumps(r, protocol)
loaded = pickle.loads(dumped)
assert r == loaded, (r, loaded)
assert r.family == loaded.family, (r, loaded)
def test0(self):
return self._test(0)
def test1(self):
return self._test(1)
def test2(self):
return self._test(2)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment