Skip to content
Snippets Groups Projects
Commit b0c84477 authored by Damian Johnson's avatar Damian Johnson
Browse files

Python3 compatability for tests

Couple regressions that mostly slipped in with the recent hashing changes.

  https://trac.torproject.org/projects/tor/ticket/27030
parent ac2b277a
No related branches found
No related tags found
No related merge requests found
......@@ -349,6 +349,7 @@ class Size(Field):
self.name = name
self.size = size
self.format = pack_format
self._hash = None
@staticmethod
def pop(packed):
......@@ -376,6 +377,12 @@ class Size(Field):
return self.unpack(to_unpack), remainder
def __hash__(self):
if self._hash is None:
self._hash = stem.util._hash_attr(self, 'name', 'size', 'format')
return self._hash
class Address(Field):
"""
......
......@@ -30,7 +30,7 @@ class TestLinkProtocol(unittest.TestCase):
self.assertEqual(7, protocol + 2)
self.assertEqual(3, protocol - 2)
self.assertEqual(15, protocol * 3)
self.assertEqual(1, protocol / 3)
self.assertEqual(1, protocol // 3)
def test_equality(self):
# LinkProtocols should be comparable with both other LinkProtocols and
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment