summaryrefslogtreecommitdiff
path: root/tests/test_name.py
diff options
context:
space:
mode:
authorJanus <ysangkok@gmail.com>2018-07-23 16:11:00 +0200
committerJanus <ysangkok@gmail.com>2018-07-31 20:10:52 +0200
commit5c5de7bb1ad26d6d6bb82ed2deb64748b46ac599 (patch)
treee4510f90a598e484e57314dc04217259ef34a690 /tests/test_name.py
parent2e6e81852b63eb64b68a08a27cc6e440819b6b58 (diff)
downloaddnspython-5c5de7bb1ad26d6d6bb82ed2deb64748b46ac599.tar.gz
Initial type signatures
Diffstat (limited to 'tests/test_name.py')
-rw-r--r--tests/test_name.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/test_name.py b/tests/test_name.py
index 85007b3..f3f04c3 100644
--- a/tests/test_name.py
+++ b/tests/test_name.py
@@ -16,10 +16,8 @@
from __future__ import print_function
-try:
- import unittest2 as unittest
-except ImportError:
- import unittest
+from typing import Dict # pylint: disable=unused-import
+import unittest
from io import BytesIO
@@ -380,14 +378,14 @@ class NameTestCase(unittest.TestCase):
def testToWire1(self):
n = dns.name.from_text('FOO.bar')
f = BytesIO()
- compress = {}
+ compress = {} # type: Dict[dns.name.Name,int]
n.to_wire(f, compress)
self.assertEqual(f.getvalue(), b'\x03FOO\x03bar\x00')
def testToWire2(self):
n = dns.name.from_text('FOO.bar')
f = BytesIO()
- compress = {}
+ compress = {} # type: Dict[dns.name.Name,int]
n.to_wire(f, compress)
n.to_wire(f, compress)
self.assertEqual(f.getvalue(), b'\x03FOO\x03bar\x00\xc0\x00')
@@ -396,7 +394,7 @@ class NameTestCase(unittest.TestCase):
n1 = dns.name.from_text('FOO.bar')
n2 = dns.name.from_text('foo.bar')
f = BytesIO()
- compress = {}
+ compress = {} # type: Dict[dns.name.Name,int]
n1.to_wire(f, compress)
n2.to_wire(f, compress)
self.assertEqual(f.getvalue(), b'\x03FOO\x03bar\x00\xc0\x00')
@@ -405,7 +403,7 @@ class NameTestCase(unittest.TestCase):
n1 = dns.name.from_text('FOO.bar')
n2 = dns.name.from_text('a.foo.bar')
f = BytesIO()
- compress = {}
+ compress = {} # type: Dict[dns.name.Name,int]
n1.to_wire(f, compress)
n2.to_wire(f, compress)
self.assertEqual(f.getvalue(), b'\x03FOO\x03bar\x00\x01\x61\xc0\x00')
@@ -414,7 +412,7 @@ class NameTestCase(unittest.TestCase):
n1 = dns.name.from_text('FOO.bar')
n2 = dns.name.from_text('a.foo.bar')
f = BytesIO()
- compress = {}
+ compress = {} # type: Dict[dns.name.Name,int]
n1.to_wire(f, compress)
n2.to_wire(f, None)
self.assertEqual(f.getvalue(),
@@ -429,7 +427,7 @@ class NameTestCase(unittest.TestCase):
def bad():
n = dns.name.from_text('FOO.bar', None)
f = BytesIO()
- compress = {}
+ compress = {} # type: Dict[dns.name.Name,int]
n.to_wire(f, compress)
self.failUnlessRaises(dns.name.NeedAbsoluteNameOrOrigin, bad)