Because _get_ipver_str() is referring to an attribute of NoneType when it is
invoked earlier than init_socket() and when the socket object is None.
for (info, ver) in addrs:
c = MockXfrinConnection({}, TEST_ZONE_NAME, RRClass.CH, None,
threading.Event(), info)
- c.init_socket()
if ver is not None:
self.assertEqual(ver, c._get_ipver_str())
else:
self.assertRaises(ValueError, c._get_ipver_str)
- c.close()
def test_soacheck(self):
# we need to defer the creation until we know the QID, which is
It raises a ValueError exception on other address families.
"""
- if self.socket.family == socket.AF_INET:
+ if self._master_addrinfo[0] == socket.AF_INET:
return 'v4'
- elif self.socket.family == socket.AF_INET6:
+ elif self._master_addrinfo[0] == socket.AF_INET6:
return 'v6'
raise ValueError("Invalid address family. "
"This is supported only for IP sockets")