Commit 2074ba32 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

removed old dns-python example code

removed Boost.Python bindings
updated xfrin/xfrout tests for new python bindings


git-svn-id: svn://bind10.isc.org/svn/bind10/experiments/python-binding@2090 e5f2f494-b856-4b98-b285-d166d9295462
parent a29e5392
......@@ -247,52 +247,6 @@ AC_SUBST(BOOST_SYSTEM_LIB)
# Check availability of the Boost Python library
AC_MSG_CHECKING([for boost::python library])
AC_ARG_WITH([boost-python],
AC_HELP_STRING([--with-boost-python],
[specify whether to use the boost python library]),
[with_boost_python="$withval"], [with_boost_python="auto"])
if test "$with_boost_python" != "no"; then
if test "$with_boost_python" != "auto" -a "X$PYTHON_LIB" = X; then
AC_MSG_ERROR([Boost.Python requested but python library is not available])
fi
LDFLAGS_SAVED="$LDFLAGS"
LIBS_SAVED="$LIBS"
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
for BOOST_TRY_LIB in boost_python boost_python-mt; do
LDFLAGS="$LDFLAGS_SAVED ${BOOST_LDFLAGS} ${PYTHON_LDFLAGS}"
LIBS="$LIBS_SAVED -l${BOOST_TRY_LIB} ${PYTHON_LIB}"
AC_TRY_LINK([#include <boost/python/module.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }],
[ return 0; ],
[ AC_MSG_RESULT(yes)
BOOST_PYTHON_LIB="-l${BOOST_TRY_LIB}"
],[])
if test "X${BOOST_PYTHON_LIB}" != X; then
break
fi
done
LDFLAGS="$LDFLAGS_SAVED"
CPPFLAGS="$CPPFLAGS_SAVED"
LIBS="$LIBS_SAVED"
fi
if test "X${BOOST_PYTHON_LIB}" = X; then
AC_MSG_RESULT(no)
if test "$with_boost_python" = "yes"; then
AC_MSG_ERROR([boost python library is requested but not found])
fi
else
AC_DEFINE(HAVE_BOOST_PYTHON, 1, Define to 1 if boost python library is available)
fi
AM_CONDITIONAL(HAVE_BOOST_PYTHON, test "X${BOOST_PYTHON_LIB}" != X)
AC_SUBST(BOOST_PYTHON_LIB)
#
# Check availability of gtest, which will be used for unit tests.
#
......@@ -408,7 +362,6 @@ AC_CONFIG_FILES([Makefile
src/lib/dns/tests/Makefile
src/lib/dns/python/Makefile
src/lib/dns/python/tests/Makefile
src/lib/dns-python/Makefile
src/lib/exceptions/Makefile
src/lib/datasrc/Makefile
src/lib/datasrc/tests/Makefile
......
PYTESTS = xfrin_test.py
EXTRA_DIST = $(PYTESTS)
if HAVE_BOOST_PYTHON
# later will have configure option to choose this, like: coverage run --branch
PYCOVERAGE = $(PYTHON)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python \
env PYTHONPATH=$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_srcdir)/src/lib/python \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest ; \
done
endif
......@@ -65,12 +65,12 @@ class TestXfrinConnection(unittest.TestCase):
self.assertRaises(Exception, self.conn._handle_xfrin_response)
def test_response_without_end_soa(self):
self.conn._send_query(rr_type.AXFR())
self.conn._send_query(RRType.AXFR())
self.conn.reply_data = self.conn.create_response_data(axfr_response1)
self.assertRaises(XfrinException, self.conn._handle_xfrin_response)
def test_response(self):
self.conn._send_query(rr_type.AXFR())
self.conn._send_query(RRType.AXFR())
self.conn.reply_data = self.conn.create_response_data(axfr_response1)
self.conn.reply_data += self.conn.create_response_data(axfr_response2)
self.conn._handle_xfrin_response()
......
PYTESTS = xfrout_test.py
EXTRA_DIST = $(PYTESTS)
if HAVE_BOOST_PYTHON
# later will have configure option to choose this, like: coverage run --branch
PYCOVERAGE = $(PYTHON)
# test using command-line arguments, so use check-local target instead of TESTS
check-local:
for pytest in $(PYTESTS) ; do \
echo Running test: $$pytest ; \
env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \
env PYTHONPATH=$(abs_top_builddir)/src/bin/xfrout:$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/xfr/.libs \
$(PYCOVERAGE) $(abs_srcdir)/$$pytest ; \
done
endif
......@@ -19,7 +19,7 @@
import unittest
import os
from isc.cc.session import *
from bind10_dns import *
from libdns_python import *
from xfrout import *
# our fake socket, where we can read and insert messages
......@@ -46,8 +46,8 @@ class MySocket():
def read_msg(self):
sent_data = self.readsent()
get_msg = message(message_mode.PARSE)
get_msg.from_wire(input_buffer(bytes(sent_data[2:])))
get_msg = Message(Message.PARSE)
get_msg.from_wire(bytes(sent_data[2:]))
return get_msg
def clear_send(self):
......@@ -69,15 +69,15 @@ class Dbserver:
class TestXfroutSession(unittest.TestCase):
def getmsg(self):
msg = message(message_mode.PARSE)
msg.from_wire(input_buffer(self.mdata))
msg = Message(Message.PARSE)
msg.from_wire(self.mdata)
return msg
def setUp(self):
request = MySocket(socket.AF_INET,socket.SOCK_STREAM)
self.xfrsess = MyXfroutSession(request, None, None)
self.xfrsess.server = Dbserver()
self.mdata = b'\xd6=\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\xfc\x00\x01'
self.mdata = bytes(b'\xd6=\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\xfc\x00\x01')
self.sock = MySocket(socket.AF_INET,socket.SOCK_STREAM)
self.soa_record = (4, 3, 'example.com.', 'com.example.', 3600, 'SOA', None, 'master.example.com. admin.example.com. 1234 3600 1800 2419200 7200')
......@@ -96,7 +96,7 @@ class TestXfroutSession(unittest.TestCase):
def test_reply_xfrout_query_with_error_rcode(self):
msg = self.getmsg()
self.xfrsess._reply_query_with_error_rcode(msg, self.sock, rcode(3))
self.xfrsess._reply_query_with_error_rcode(msg, self.sock, Rcode(3))
get_msg = self.sock.read_msg()
self.assertEqual(get_msg.get_rcode().to_text(), "NXDOMAIN")
......@@ -110,7 +110,7 @@ class TestXfroutSession(unittest.TestCase):
self.assertEqual(msg.get_qid(), qid)
self.assertEqual(msg.get_opcode(), opcode)
self.assertEqual(msg.get_rcode(), rcode)
self.assertTrue(msg.get_header_flag(message_flag.AA()))
self.assertTrue(msg.get_header_flag(MessageFlag.AA()))
def test_reply_query_with_format_error(self):
......@@ -122,11 +122,10 @@ class TestXfroutSession(unittest.TestCase):
def test_create_rrset_from_db_record(self):
rrset = self.xfrsess._create_rrset_from_db_record(self.soa_record)
self.assertEqual(rrset.get_name().to_text(), "example.com.")
self.assertEqual(rrset.get_class(), rr_class.IN())
self.assertEqual(rrset.get_class(), RRClass("IN"))
self.assertEqual(rrset.get_type().to_text(), "SOA")
rdata_iter = rrset.get_rdata_iterator()
rdata_iter.first()
self.assertEqual(rdata_iter.get_current().to_text(), self.soa_record[7])
rdata = rrset.get_rdata()
self.assertEqual(rdata[0].to_text(), self.soa_record[7])
def test_send_message_with_last_soa(self):
rrset_soa = self.xfrsess._create_rrset_from_db_record(self.soa_record)
......@@ -136,18 +135,17 @@ class TestXfroutSession(unittest.TestCase):
self.xfrsess._send_message_with_last_soa(msg, self.sock, rrset_soa)
get_msg = self.sock.read_msg()
self.assertEqual(get_msg.get_rr_count(section.QUESTION()), 1)
self.assertEqual(get_msg.get_rr_count(section.ANSWER()), 1)
self.assertEqual(get_msg.get_rr_count(section.AUTHORITY()), 0)
self.assertEqual(get_msg.get_rr_count(Section.QUESTION()), 1)
self.assertEqual(get_msg.get_rr_count(Section.ANSWER()), 1)
self.assertEqual(get_msg.get_rr_count(Section.AUTHORITY()), 0)
answer_rrset_iter = section_iter(get_msg, section.ANSWER())
answer = answer_rrset_iter.get_rrset()
#answer_rrset_iter = section_iter(get_msg, section.ANSWER())
answer = get_msg.get_section(Section.ANSWER())[0]#answer_rrset_iter.get_rrset()
self.assertEqual(answer.get_name().to_text(), "example.com.")
self.assertEqual(answer.get_class(), rr_class.IN())
self.assertEqual(answer.get_class(), RRClass("IN"))
self.assertEqual(answer.get_type().to_text(), "SOA")
rdata_iter = answer.get_rdata_iterator()
rdata_iter.first()
self.assertEqual(rdata_iter.get_current().to_text(), self.soa_record[7])
rdata = answer.get_rdata()
self.assertEqual(rdata[0].to_text(), self.soa_record[7])
def test_get_message_len(self):
msg = self.getmsg()
......@@ -195,7 +193,7 @@ class TestXfroutSession(unittest.TestCase):
def test_dns_xfrout_start_formerror(self):
# formerror
self.xfrsess.dns_xfrout_start(self.sock, b"\xd6=\x00\x00\x00\x01\x00")
self.assertRaises(MessageTooShort, self.xfrsess.dns_xfrout_start, self.sock, b"\xd6=\x00\x00\x00\x01\x00")
sent_data = self.sock.readsent()
self.assertEqual(len(sent_data), 0)
......@@ -205,7 +203,7 @@ class TestXfroutSession(unittest.TestCase):
def test_dns_xfrout_start_notauth(self):
self.xfrsess._get_query_zone_name = self.default
def notauth(formpara):
return rcode.NOTAUTH()
return Rcode.NOTAUTH()
self.xfrsess._check_xfrout_available = notauth
self.xfrsess.dns_xfrout_start(self.sock, self.mdata)
get_msg = self.sock.read_msg()
......@@ -214,7 +212,7 @@ class TestXfroutSession(unittest.TestCase):
def test_dns_xfrout_start_noerror(self):
self.xfrsess._get_query_zone_name = self.default
def noerror(form):
return rcode.NOERROR()
return Rcode.NOERROR()
self.xfrsess._check_xfrout_available = noerror
def myreply(msg, sock, zonename):
......@@ -236,7 +234,7 @@ class TestXfroutSession(unittest.TestCase):
sqlite3_ds.get_zone_datas = get_zone_datas
self.xfrsess._reply_xfrout_query(self.getmsg(), self.sock, "example.com.")
reply_msg = self.sock.read_msg()
self.assertEqual(reply_msg.get_rr_count(section.ANSWER()), 2)
self.assertEqual(reply_msg.get_rr_count(Section.ANSWER()), 2)
# set event
self.xfrsess.server._shutdown_event.set()
......
......@@ -80,7 +80,7 @@ class XfroutSession(BaseRequestHandler):
#TODO, need to add parseHeader() in case the message header is invalid
try:
msg = Message(Message.PARSE)
msg.from_wire(mdata)
Message.from_wire(msg, mdata)
except TmpException as err:
if verbose_mode:
self.log_msg(str(err))
......
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
if GCC_WERROR_OK
AM_CPPFLAGS += -Werror
endif
pyexec_LTLIBRARIES = bind10_dns_noboost.la
bind10_dns_noboost_la_SOURCES = cpp_binding.cc
bind10_dns_noboost_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_INCLUDES)
bind10_dns_noboost_la_LDFLAGS = $(PYTHON_LDFLAGS)
# Python prefers .so, while some OSes (specifically MacOS) use a different
# suffix for dynamic objects. -module is necessary to work this around.
bind10_dns_noboost_la_LDFLAGS += -module
bind10_dns_noboost_la_LIBADD = $(top_builddir)/src/lib/dns/libdns.la
bind10_dns_noboost_la_LIBADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
bind10_dns_noboost_la_LIBADD += $(PYTHON_LIB)
This diff is collapsed.
"""Python C bindings"""
import bind10_dns_noboost
class Name(bind10_dns_noboost.cName):
"""Python shadow class of cName"""
def __init__(self, *args):
"""initializer"""
super(Name, self).__init__(*args)
def __len__(self):
"""length"""
return self.getLength()
def __str__(self):
"""string"""
return self.toText()
def __repr__(self):
"""representation"""
return '<Name: ' + str(self) +'>'
class MessageRenderer(bind10_dns_noboost.cMessageRenderer):
"""Python shadow class of cMessageRenderer"""
def __init__(self):
"""initializer"""
super(MessageRenderer, self).__init__()
def fromText(text, downcase=False):
"""fromText factory"""
return Name(text, downcase)
def fromWire(wire, position, downcase=False):
"""fromWire factory"""
n = Name(wire, position, downcase)
return (n, n.getPosition() - position)
def compare(n1, n2):
"""compare"""
ncr = n1.compare(n2)
return (ncr.getOrder(), \
ncr.getCommonLabels(), \
bind10_dns_noboost.NameRelation[ncr.getRelation()])
def concatenate(n1, n2):
"""concatenate"""
return n1.concatenate(n2)
"""Python tests"""
from dns import *
example = fromText("www.example.com")
upper = fromText("WWW.EXAMPLE.COM")
small = fromText("aaa.example.com")
large = fromText("zzz.example.com")
def f2b(name):
"""file to binary"""
f = open(name)
rl = f.readlines()
f.close()
b = bytearray()
for l in rl:
if l[0] == '#':
continue
if l[-1] == '\n':
l = l[:-1]
b += bytearray().fromhex(l)
return bytes(b)
def nflc():
"""name Factory Lower Case"""
namestr = ''
labelcount = 0
for ch in range(0, bind10_dns_noboost.MAX_WIRE + 1):
if (ch < ord('A')) or (ch > ord('Z')):
ss = '%03d' % ch
namestr += '\\' + ss
labelcount += 1
if labelcount == bind10_dns_noboost.MAX_LABELLEN:
namestr += '.'
labelcount = 0
return Name(namestr)
def testFT():
"""fromText"""
nl = []
nl.append(fromText("www.example.com"))
nl.append(fromText("www.example.com.")) # with a trailing dot
nl.append(fromText("wWw.exAmpLe.com")) # mixed cases
nl.append(fromText("\\wWw.exAmpLe.com")) # escape with a backslash
# decimal representation for "WWW"
nl.append(fromText("\\087\\087\\087.example.com"))
for it in nl:
if it != example:
print('FAILED: (FT)',it,'!=',example)
# root names
if fromText("@") != fromText("."):
print('FAILED: (FT) root name')
# downcase
n = fromText("Www.eXample.coM", True)
if n.toWire() != example.toWire():
print('FAILED: (FT) downcase')
#
# Tests for bogus names. These should trigger an exception.
#
# empty label cannot be followed by another label
try:
n = fromText(".a")
print('FAILED: (FT) .a')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'EmptyLabel':
print('FAILED: (FT) .a')
# duplicate period
try:
n = fromText("a..")
print('FAILED: (FT) a..')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'EmptyLabel':
print('FAILED: (FT) a..')
# label length must be < 64
try:
n = fromText("012345678901234567890123456789" +
"012345678901234567890123456789" +
"0123")
print('FAILED: (FT) TooLongLabel')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'TooLongLabel':
print('FAILED: (FT) TooLongLabel')
# now-unsupported bitstring labels
try:
n = fromText("\\[b11010000011101]")
print('FAILED: (FT) BadLabelType')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadLabelType':
print('FAILED: (FT) BadLabelType')
# label length must be < 64
try:
n = fromText("012345678901234567890123456789" +
"012345678901234567890123456789" +
"012\\x")
print('FAILED: (FT) TooLongLabel')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'TooLongLabel':
print('FAILED: (FT) TooLongLabel')
# but okay as long as resulting len < 64 even if the original string is
# "too long"
try:
n = fromText("012345678901234567890123456789" +
"012345678901234567890123456789" +
"01\\x")
except bind10_dns_noboost.DNSException:
print('FAILED: (FT) too long')
# incomplete \DDD pattern (exactly 3 D's must appear)
try:
n = fromText("\\12abc")
print('FAILED: (FT) BadEscape')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadEscape':
print('FAILED: (FT) BadEscape')
# \DDD must not exceed 255
try:
n = fromText("\\256")
print('FAILED: (FT) BadEscape')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadEscape':
print('FAILED: (FT) BadEscape')
# Same tests for \111 as for \\x above
try:
n = fromText("012345678901234567890123456789" +
"012345678901234567890123456789" +
"012\\111")
print('FAILED: (FT) TooLongLabel')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'TooLongLabel':
print('FAILED: (FT) TooLongLabel')
try:
n = fromText("012345678901234567890123456789" +
"012345678901234567890123456789" +
"01\\111")
except bind10_dns_noboost.DNSException:
print('FAILED: (FT) too long')
# A domain name must be 255 octets or less
try:
n = fromText("123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"1234")
print('FAILED: (FT) TooLongName')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'TooLongName':
print('FAILED: (FT) TooLongName')
# This is a possible longest name and should be accepted
try:
n = fromText("123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123456789.123456789.123456789.123456789.123456789." +
"123")
except bind10_dns_noboost.DNSException:
print('FAILED: (FT) longest')
# \DDD must consist of 3 digits
try:
n = fromText("\\12")
print('FAILED: (FT) IncompleteName')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'IncompleteName':
print('FAILED: (FT) IncompleteName')
# a name with the max number of labels. should be constructed without
# an error, and its length should be the max value.
try:
n = fromText("0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9." + # 40
"0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9." + # 80
"0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9." + # 120
"0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9." + # 160
"0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9." + # 200
"0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9." + # 240
"0.1.2.3.4.5.6.")
if bind10_dns_noboost.MAX_LABELS != n.getLabelCount():
print('FAILED: (FT)',bind10_dns_noboost.MAX_LABELS,'!=',
n.getLabelCount())
except bind10_dns_noboost.DNSException:
print('FAILED: (FT) maxlabels')
def testFW():
"""fromWire"""
#
# test cases derived from BIND9 tests.
#
# normal case with a compression pointer
(n, _) = fromWire(f2b("testdata/name_fromWire1"), 25)
if n != fromText("vix.com"):
print('FAILED: (FW) n',n.toText(),'!=',"vix.com")
# bogus label character (looks like a local compression pointer)
try:
(n, _) = fromWire(f2b("testdata/name_fromWire2"), 25)
print('FAILED: (FW) BadLabelType')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadLabelType':
print('FAILED: (FW) BadLabelType')
# a bad compression pointer (too big)
try:
(n, _) = fromWire(f2b("testdata/name_fromWire3_1"), 25)
print('FAILED: (FW) BadPointer')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadPointer':
print('FAILED: (FW) BadPointer')
# forward reference
try:
(n, _) = fromWire(f2b("testdata/name_fromWire3_2"), 25)
print('FAILED: (FW) BadPointer')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadPointer':
print('FAILED: (FW) BadPointer')
# invalid name length
try:
(n, _) = fromWire(f2b("testdata/name_fromWire4"), 550)
print('FAILED: (FW) TooLongName')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'TooLongName':
print('FAILED: (FW) TooLongName')
# skip test for from Wire5. It's for disabling decompression, but our
# implementation always allows it.
# bad pointer (too big)
try:
(n, _) = fromWire(f2b("testdata/name_fromWire6"), 25)
print('FAILED: (FW) BadPointer')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadPointer':
print('FAILED: (FW) BadPointer')
# input ends unexpectedly
try:
(n, _) = fromWire(f2b("testdata/name_fromWire7"), 25)
print('FAILED: (FW) IncompleteName')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'IncompleteName':
print('FAILED: (FW) IncompleteName')
# many hops of compression but valid. should succeed
try:
(n, _) = fromWire(f2b("testdata/name_fromWire8"), 383)
if n != fromText("vix.com"):
print('FAILED: (FW) vix.com')
except bind10_dns_noboost.DNSException:
print('FAILED: (FW) vix.com')
#
# Additional test cases
#
# large names, a long but valid one, and invalid (too long) one.
try:
(n, _) = fromWire(f2b("testdata/name_fromWire9"), 0)
if n.getLength() != bind10_dns_noboost.MAX_WIRE:
print('FAILED: (FW) ong but valid')
except bind10_dns_noboost.DNSException:
print('FAILED: (FW) ong but valid')
try:
(n, _) = fromWire(f2b("testdata/name_fromWire10"), 0)
print('FAILED: (FW) TooLongName')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'TooLongName':
print('FAILED: (FW) TooLongName')
# A name with possible maximum number of labels; awkward but valid
try:
(n, _) = fromWire(f2b("testdata/name_fromWire11"), 0)
if n.getLabelCount() != bind10_dns_noboost.MAX_LABELS:
print('FAILED: (FW) maxlabels')
except bind10_dns_noboost.DNSException:
print('FAILED: (FW) maxlabels')
# Wire format including an invalid label length
try:
(n, _) = fromWire(f2b("testdata/name_fromWire12"), 0)
print('FAILED: (FW) BadLabelType')
except bind10_dns_noboost.DNSException as e:
if str(e) != 'BadLabelType':
print('FAILED: (FW) BadLabelType')
# converting upper-case letters to down-case
(n, _) = fromWire(f2b("testdata/name_fromWire1"), 25, True)