tests/unit: fix pep8
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
bd61cd5dd1
commit
857ec0c019
@ -249,7 +249,7 @@ class Test_rpc(unittest.TestCase):
|
||||
c.receive_notification()
|
||||
assert len(l) == 1
|
||||
n = l.pop(0)
|
||||
assert not n is None
|
||||
assert n is not None
|
||||
method, params = n
|
||||
assert method == "notify_hoge"
|
||||
assert params[0] == obj
|
||||
@ -265,7 +265,7 @@ class Test_rpc(unittest.TestCase):
|
||||
c.receive_notification()
|
||||
assert len(l) == 1
|
||||
n = l.pop(0)
|
||||
assert not n is None
|
||||
assert n is not None
|
||||
method, params = n
|
||||
assert method == "notify_hoge"
|
||||
assert params[0] == obj
|
||||
@ -355,14 +355,14 @@ class Test_rpc(unittest.TestCase):
|
||||
assert done.issubset(s)
|
||||
s -= done
|
||||
r = e.get_request()
|
||||
if not r is None:
|
||||
if r is not None:
|
||||
msgid, method, params = r
|
||||
assert method == "ourcallback"
|
||||
omsgid, n, cb, v = params
|
||||
assert omsgid in s
|
||||
assert cb == "ourcallback"
|
||||
assert n > 0
|
||||
e.send_response(msgid, result=[omsgid, n-1, cb, v+1])
|
||||
e.send_response(msgid, result=[omsgid, n - 1, cb, v + 1])
|
||||
assert sum == (1 + num_calls) * num_calls / 2
|
||||
finally:
|
||||
self._client_sock.setblocking(old_blocking)
|
||||
|
@ -1444,8 +1444,8 @@ class TestNXActionRegLoad(unittest.TestCase):
|
||||
len_ = {'buf': '\x00\x18', 'val': ofproto.NX_ACTION_REG_MOVE_SIZE}
|
||||
vendor = {'buf': '\x00\x00\x23\x20', 'val': ofproto.NX_VENDOR_ID}
|
||||
subtype = {'buf': '\x00\x07', 'val': ofproto.NXAST_REG_LOAD}
|
||||
ofs_nbits = {'buf': '\x3d\x98', 'val': 15768}
|
||||
dst = {'buf': '\x9f\x9f\x88\x26', 'val': 2678032422}
|
||||
ofs_nbits = {'buf': '\x3d\x98', 'val': 15768}
|
||||
dst = {'buf': '\x9f\x9f\x88\x26', 'val': 2678032422}
|
||||
value = {'buf': '\x33\x51\xcd\x43\x25\x28\x18\x99',
|
||||
'val': 3697962457317775513}
|
||||
|
||||
@ -2992,7 +2992,7 @@ class TestOFPVendor(unittest.TestCase):
|
||||
eq_(data, res[5])
|
||||
|
||||
|
||||
#class TestNXTRequest(unittest.TestCase):
|
||||
# class TestNXTRequest(unittest.TestCase):
|
||||
class TestNiciraHeader(unittest.TestCase):
|
||||
""" Test case for ofproto_v1_0_parser.NiciraHeader
|
||||
"""
|
||||
|
@ -83,7 +83,7 @@ class TestMsgParser(unittest.TestCase):
|
||||
msg_type = ofproto.OFPT_HELLO
|
||||
|
||||
fmt = ofproto.OFP_HEADER_PACK_STR
|
||||
buf = pack(fmt, version, msg_type, msg_len, xid)
|
||||
buf = pack(fmt, version, msg_type, msg_len, xid)
|
||||
|
||||
c = msg_parser(_Datapath, version, msg_type, msg_len, xid, buf)
|
||||
|
||||
@ -1454,7 +1454,7 @@ class TestOFPExperimenter(unittest.TestCase):
|
||||
msg_len = ofproto.OFP_EXPERIMENTER_HEADER_SIZE
|
||||
|
||||
fmt = ofproto.OFP_HEADER_PACK_STR
|
||||
buf = pack(fmt, version, msg_type, msg_len, xid)
|
||||
buf = pack(fmt, version, msg_type, msg_len, xid)
|
||||
|
||||
# OFP_EXPERIMENTER_HEADER_PACK_STR
|
||||
# '!II'...experimenter, exp_type
|
||||
@ -6505,7 +6505,7 @@ class TestOFPRoleReply(unittest.TestCase):
|
||||
|
||||
# OFP_ROLE_REQUEST_PACK_STR
|
||||
# '!I4xQ'...role, pad(4), generation_id
|
||||
#role = ofproto.OFPCR_ROLE_NOCHANGE
|
||||
# role = ofproto.OFPCR_ROLE_NOCHANGE
|
||||
role = 2147483648
|
||||
generation_id = 1270985291017894273
|
||||
|
||||
|
@ -91,19 +91,13 @@ class Test_bgp(unittest.TestCase):
|
||||
bgp.BGP_COMMUNITY_NO_ADVERTISE,
|
||||
]
|
||||
ecommunities = [
|
||||
bgp.BGPTwoOctetAsSpecificExtendedCommunity(subtype=1,
|
||||
as_number=65500,
|
||||
local_administrator=
|
||||
3908876543),
|
||||
bgp.BGPFourOctetAsSpecificExtendedCommunity(subtype=2,
|
||||
as_number=10000000,
|
||||
local_administrator=
|
||||
59876),
|
||||
bgp.BGPIPv4AddressSpecificExtendedCommunity(subtype=3,
|
||||
ipv4_address=
|
||||
'192.0.2.1',
|
||||
local_administrator=
|
||||
65432),
|
||||
bgp.BGPTwoOctetAsSpecificExtendedCommunity(
|
||||
subtype=1, as_number=65500, local_administrator=3908876543),
|
||||
bgp.BGPFourOctetAsSpecificExtendedCommunity(
|
||||
subtype=2, as_number=10000000, local_administrator=59876),
|
||||
bgp.BGPIPv4AddressSpecificExtendedCommunity(
|
||||
subtype=3, ipv4_address='192.0.2.1',
|
||||
local_administrator=65432),
|
||||
bgp.BGPOpaqueExtendedCommunity(opaque='abcdefg'),
|
||||
bgp.BGPUnknownExtendedCommunity(type_=99, value='abcdefg'),
|
||||
]
|
||||
@ -128,7 +122,7 @@ class Test_bgp(unittest.TestCase):
|
||||
nlri=mp_nlri),
|
||||
bgp.BGPPathAttributeMpUnreachNLRI(afi=afi.IP, safi=safi.MPLS_VPN,
|
||||
withdrawn_routes=mp_nlri),
|
||||
bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300*'bar')
|
||||
bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * 'bar')
|
||||
]
|
||||
nlri = [
|
||||
bgp.BGPNLRI(length=24, addr='203.0.113.1'),
|
||||
@ -240,19 +234,13 @@ class Test_bgp(unittest.TestCase):
|
||||
bgp.BGP_COMMUNITY_NO_ADVERTISE,
|
||||
]
|
||||
ecommunities = [
|
||||
bgp.BGPTwoOctetAsSpecificExtendedCommunity(subtype=1,
|
||||
as_number=65500,
|
||||
local_administrator=
|
||||
3908876543),
|
||||
bgp.BGPFourOctetAsSpecificExtendedCommunity(subtype=2,
|
||||
as_number=10000000,
|
||||
local_administrator=
|
||||
59876),
|
||||
bgp.BGPIPv4AddressSpecificExtendedCommunity(subtype=3,
|
||||
ipv4_address=
|
||||
'192.0.2.1',
|
||||
local_administrator=
|
||||
65432),
|
||||
bgp.BGPTwoOctetAsSpecificExtendedCommunity(
|
||||
subtype=1, as_number=65500, local_administrator=3908876543),
|
||||
bgp.BGPFourOctetAsSpecificExtendedCommunity(
|
||||
subtype=2, as_number=10000000, local_administrator=59876),
|
||||
bgp.BGPIPv4AddressSpecificExtendedCommunity(
|
||||
subtype=3, ipv4_address='192.0.2.1',
|
||||
local_administrator=65432),
|
||||
bgp.BGPOpaqueExtendedCommunity(opaque='abcdefg'),
|
||||
bgp.BGPUnknownExtendedCommunity(type_=99, value='abcdefg'),
|
||||
]
|
||||
@ -277,7 +265,7 @@ class Test_bgp(unittest.TestCase):
|
||||
nlri=mp_nlri),
|
||||
bgp.BGPPathAttributeMpUnreachNLRI(afi=afi.IP, safi=safi.MPLS_VPN,
|
||||
withdrawn_routes=mp_nlri),
|
||||
bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300*'bar')
|
||||
bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * 'bar')
|
||||
]
|
||||
nlri = [
|
||||
bgp.BGPNLRI(length=24, addr='203.0.113.1'),
|
||||
|
@ -1246,7 +1246,7 @@ class Test_mldv2_query(unittest.TestCase):
|
||||
i = ipv6(nxt=inet.IPPROTO_ICMPV6)
|
||||
ic = icmpv6.icmpv6(type_=icmpv6.MLD_LISTENER_QUERY,
|
||||
data=self.mld)
|
||||
p = e/i/ic
|
||||
p = e / i / ic
|
||||
return p
|
||||
|
||||
def test_build_mldv2_query(self):
|
||||
@ -1520,7 +1520,7 @@ class Test_mldv2_report(unittest.TestCase):
|
||||
i = ipv6(nxt=inet.IPPROTO_ICMPV6)
|
||||
ic = icmpv6.icmpv6(type_=icmpv6.MLDV2_LISTENER_REPORT,
|
||||
data=self.mld)
|
||||
p = e/i/ic
|
||||
p = e / i / ic
|
||||
return p
|
||||
|
||||
def test_build_mldv2_report(self):
|
||||
|
@ -760,7 +760,7 @@ class Test_routing(unittest.TestCase):
|
||||
"2001:db8:dead::3"]
|
||||
# calculate pad
|
||||
self.pad = (8 - ((len(self.adrs) - 1) * (16 - self.cmpi) +
|
||||
(16 - self.cmpe) % 8)) % 8
|
||||
(16 - self.cmpe) % 8)) % 8
|
||||
# create buf
|
||||
self.form = '!BBBBBB2x16s16s16s'
|
||||
self.buf = struct.pack(self.form, self.nxt, self.size,
|
||||
@ -818,7 +818,7 @@ class Test_routing_type3(unittest.TestCase):
|
||||
"2001:db8:dead::3"]
|
||||
# calculate pad
|
||||
self.pad = (8 - ((len(self.adrs) - 1) * (16 - self.cmpi) +
|
||||
(16 - self.cmpe) % 8)) % 8
|
||||
(16 - self.cmpe) % 8)) % 8
|
||||
|
||||
self.routing = ipv6.routing_type3(
|
||||
self.nxt, self.size, self.type_, self.seg, self.cmpi,
|
||||
@ -939,7 +939,7 @@ class Test_routing_type3(unittest.TestCase):
|
||||
"2001:0db8:dead:0123:4567:89ab:cdef:0003"]
|
||||
# calculate pad
|
||||
pad = (8 - ((len(adrs) - 1) * (16 - cmpi) + (16 - cmpe) % 8)) % 8
|
||||
form = '!BBBBBB2x%ds%ds%ds' % (16-cmpi, 16-cmpi, 16-cmpe)
|
||||
form = '!BBBBBB2x%ds%ds%ds' % (16 - cmpi, 16 - cmpi, 16 - cmpe)
|
||||
slice_i = slice(cmpi, 16)
|
||||
slice_e = slice(cmpe, 16)
|
||||
buf = struct.pack(form, nxt, size, type_, seg,
|
||||
|
@ -568,7 +568,7 @@ class TestPacket(unittest.TestCase):
|
||||
ip = ipv4.ipv4(proto=inet.IPPROTO_SCTP)
|
||||
s = sctp.sctp(chunks=[sctp.chunk_data(payload_data=self.payload)])
|
||||
|
||||
p = e/ip/s
|
||||
p = e / ip / s
|
||||
p.serialize()
|
||||
|
||||
ipaddr = addrconv.ipv4.text_to_bin('0.0.0.0')
|
||||
@ -724,7 +724,7 @@ class TestPacket(unittest.TestCase):
|
||||
ip = ipv4.ipv4(proto=inet.IPPROTO_ICMP)
|
||||
ic = icmp.icmp()
|
||||
|
||||
p = e/ip/ic
|
||||
p = e / ip / ic
|
||||
p.serialize()
|
||||
|
||||
ipaddr = addrconv.ipv4.text_to_bin('0.0.0.0')
|
||||
@ -858,7 +858,7 @@ class TestPacket(unittest.TestCase):
|
||||
ip = ipv6.ipv6(nxt=inet.IPPROTO_UDP)
|
||||
u = udp.udp()
|
||||
|
||||
p = e/ip/u/self.payload
|
||||
p = e / ip / u / self.payload
|
||||
p.serialize()
|
||||
|
||||
ipaddr = addrconv.ipv6.text_to_bin('::')
|
||||
@ -979,7 +979,7 @@ class TestPacket(unittest.TestCase):
|
||||
ip = ipv6.ipv6()
|
||||
t = tcp.tcp(option='\x01\x02')
|
||||
|
||||
p = e/ip/t/self.payload
|
||||
p = e / ip / t / self.payload
|
||||
p.serialize()
|
||||
|
||||
ipaddr = addrconv.ipv6.text_to_bin('::')
|
||||
@ -1117,7 +1117,7 @@ class TestPacket(unittest.TestCase):
|
||||
ip = ipv6.ipv6(nxt=inet.IPPROTO_SCTP)
|
||||
s = sctp.sctp(chunks=[sctp.chunk_data(payload_data=self.payload)])
|
||||
|
||||
p = e/ip/s
|
||||
p = e / ip / s
|
||||
p.serialize()
|
||||
|
||||
ipaddr = addrconv.ipv6.text_to_bin('::')
|
||||
@ -1260,7 +1260,7 @@ class TestPacket(unittest.TestCase):
|
||||
ip = ipv6.ipv6(nxt=inet.IPPROTO_ICMPV6)
|
||||
ic = icmpv6.icmpv6()
|
||||
|
||||
p = e/ip/ic
|
||||
p = e / ip / ic
|
||||
p.serialize()
|
||||
|
||||
ipaddr = addrconv.ipv6.text_to_bin('::')
|
||||
@ -1521,7 +1521,7 @@ class TestPacket(unittest.TestCase):
|
||||
e = ethernet.ethernet(self.dst_mac, self.src_mac, ether.ETH_TYPE_IP)
|
||||
i = ipv4.ipv4()
|
||||
u = udp.udp(self.src_port, self.dst_port)
|
||||
pkt = e/i/u
|
||||
pkt = e / i / u
|
||||
ok_(isinstance(pkt, packet.Packet))
|
||||
ok_(isinstance(pkt.protocols[0], ethernet.ethernet))
|
||||
ok_(isinstance(pkt.protocols[1], ipv4.ipv4))
|
||||
|
@ -673,7 +673,7 @@ class Test_sctp(unittest.TestCase):
|
||||
eq_(self.dst_port, res[1])
|
||||
eq_(self.vtag, res[2])
|
||||
# skip compare checksum
|
||||
#eq_(self.csum, res[3])
|
||||
# eq_(self.csum, res[3])
|
||||
|
||||
return buf[sctp.sctp._MIN_LEN:]
|
||||
|
||||
@ -1227,7 +1227,7 @@ class Test_sctp(unittest.TestCase):
|
||||
ether.ETH_TYPE_IP)
|
||||
ip4 = ipv4.ipv4(4, 5, 16, 0, 0, 2, 0, 64, inet.IPPROTO_SCTP, 0,
|
||||
'192.168.1.1', '10.144.1.1')
|
||||
pkt = eth/ip4/self.sc
|
||||
pkt = eth / ip4 / self.sc
|
||||
|
||||
eth = pkt.get_protocol(ethernet.ethernet)
|
||||
ok_(eth)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import unittest
|
||||
from nose.tools import ok_, eq_
|
||||
#from ryu.app.simple_switch import SimpleSwitch
|
||||
# from ryu.app.simple_switch import SimpleSwitch
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import unittest
|
||||
from nose.tools import ok_, eq_
|
||||
#from ryu.app.simple_switch import SimpleSwitch
|
||||
# from ryu.app.simple_switch import SimpleSwitch
|
||||
|
||||
|
||||
class TestSample2(unittest.TestCase):
|
||||
|
Loading…
x
Reference in New Issue
Block a user