Skip to content

Commit 3fc2bdc

Browse files
committed
Flake8 fixes.
1 parent 0eed9a6 commit 3fc2bdc

File tree

4 files changed

+26
-30
lines changed

4 files changed

+26
-30
lines changed

keamodule/tests/test_callout_handle.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_ok(self):
2525
m = kea.CalloutManager()
2626
h = kea.CalloutHandle(m)
2727
self.assertEqual(2, m.use_count)
28-
h = None
28+
del h
2929
self.assertEqual(1, m.use_count)
3030

3131

@@ -34,11 +34,11 @@ class TestCalloutHandle_setArgument(utils.BaseTestCase):
3434
def test_lease4(self):
3535
m = kea.CalloutManager()
3636
h = kea.CalloutHandle(m)
37-
l = kea.Lease4()
38-
l.addr = '1.2.3.4'
39-
self.assertEqual(1, l.use_count)
40-
self.assertIsNone(h.setArgument('lease4', l))
41-
self.assertEqual(2, l.use_count)
37+
x = kea.Lease4()
38+
x.addr = '1.2.3.4'
39+
self.assertEqual(1, x.use_count)
40+
self.assertIsNone(h.setArgument('lease4', x))
41+
self.assertEqual(2, x.use_count)
4242
self.assertEqual('1.2.3.4', h.getArgument('lease4').addr)
4343

4444

@@ -53,7 +53,7 @@ def test_ok(self):
5353

5454

5555
class TestCalloutHandle_getContext(utils.BaseTestCase):
56-
56+
5757
def test_ok(self):
5858
m = kea.CalloutManager()
5959
h = kea.CalloutHandle(m)
@@ -67,11 +67,12 @@ def test_notset(self):
6767
h = kea.CalloutHandle(m)
6868
with self.assertRaises(TypeError) as cm:
6969
h.getContext('foo')
70-
self.assertEqual(("unable to find callout context associated with the current library index (-1)",), cm.exception.args)
70+
self.assertEqual(("unable to find callout context associated with the current"
71+
" library index (-1)",), cm.exception.args)
7172

7273

7374
class TestCalloutHandle_deleteContext(utils.BaseTestCase):
74-
75+
7576
def test_ok(self):
7677
m = kea.CalloutManager()
7778
h = kea.CalloutHandle(m)
@@ -83,15 +84,15 @@ def test_ok(self):
8384

8485

8586
class TestCalloutHandle_getStatus(utils.BaseTestCase):
86-
87+
8788
def test_ok(self):
8889
m = kea.CalloutManager()
8990
h = kea.CalloutHandle(m)
9091
self.assertEqual(kea.NEXT_STEP_CONTINUE, h.getStatus())
9192

9293

9394
class TestCalloutHandle_setStatus(utils.BaseTestCase):
94-
95+
9596
def test_ok(self):
9697
m = kea.CalloutManager()
9798
h = kea.CalloutHandle(m)

keamodule/tests/test_callout_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import unittest
2-
31
import kea
42
import utils
53

keamodule/tests/test_option.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import unittest
21
import codecs
32

43
import kea
@@ -135,7 +134,9 @@ def test_uint8(self):
135134
self.assertEqual('type=042, len=001: 05', o.toText())
136135

137136
def test_nested(self):
138-
o = kea.Option(42).addOption(kea.Option(4).setUint16(5)).addOption(kea.Option(6).setString('hello'))
137+
o = kea.Option(42).addOption(kea.Option(4)
138+
.setUint16(5)).addOption(kea.Option(6)
139+
.setString('hello'))
139140
self.assertEqual("""\
140141
type=042, len=011: ,
141142
options:

keamodule/tests/test_pkt4.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import unittest
21
import textwrap
32
from ipaddress import IPv4Network
43

@@ -139,18 +138,6 @@ def test_bytes_option_ok(self):
139138
self.assertIs(p, p.addOption(o))
140139
self.assertEqual(2, o.use_count)
141140

142-
143-
class TestPkt4_getOption(utils.BaseTestCase):
144-
145-
def test_ok(self):
146-
p = kea.Pkt4(kea.DHCPREQUEST, 42)
147-
o = p.getOption(kea.DHO_DHCP_MESSAGE_TYPE)
148-
self.assertIsInstance(o, kea.Option)
149-
self.assertEqual(bytes([kea.DHCPREQUEST]), o.getBytes())
150-
151-
152-
class TestPkt4_addOption(utils.BaseTestCase):
153-
154141
def test_ok(self):
155142
p = kea.Pkt4(kea.DHCPREQUEST, 42)
156143
o = kea.Option(kea.DHO_DHCP_AGENT_OPTIONS)
@@ -161,14 +148,23 @@ def test_ok(self):
161148
self.assertEqual(kea.DHO_DHCP_AGENT_OPTIONS, n.getType())
162149

163150

151+
class TestPkt4_getOption(utils.BaseTestCase):
152+
153+
def test_ok(self):
154+
p = kea.Pkt4(kea.DHCPREQUEST, 42)
155+
o = p.getOption(kea.DHO_DHCP_MESSAGE_TYPE)
156+
self.assertIsInstance(o, kea.Option)
157+
self.assertEqual(bytes([kea.DHCPREQUEST]), o.getBytes())
158+
159+
164160
class TestPkt4_toText(utils.BaseTestCase):
165161

166162
def test_empty(self):
167163
p = kea.Pkt4(kea.DHCPREQUEST, 42)
168164
self.assertEqual(textwrap.dedent("""\
169165
local_address=0.0.0.0:67, remote_address=0.0.0.0:68, msg_type=DHCPREQUEST (3), transid=0x2a,
170166
options:
171-
type=053, len=001: 3 (uint8)"""), p.toText())
167+
type=053, len=001: 3 (uint8)"""), p.toText()) # noqa: E501
172168

173169
def test_filled(self):
174170
p = kea.Pkt4(kea.DHCPREQUEST, 42) # 53
@@ -190,4 +186,4 @@ def test_filled(self):
190186
type=051, len=004: 00:00:1c:20
191187
type=053, len=001: 3 (uint8)
192188
type=058, len=004: 00:00:07:08
193-
type=059, len=004: 00:00:0e:10"""), p.toText())
189+
type=059, len=004: 00:00:0e:10"""), p.toText()) # noqa: E501

0 commit comments

Comments
 (0)