Skip to content

Commit 122a04f

Browse files
committed
refactor: remove unnecessary test type annotations
1 parent a88a343 commit 122a04f

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

tests/test_rpc_matchers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class TestSipgateRpcMatchers(TestCase):
11-
def test_xml_rpc(self) -> None:
11+
def test_xml_rpc(self):
1212
assertions = [
1313
(False, ('POST', '/jsonrpc', json.dumps({'method': 'test_method', 'version': '1.1', 'params': [], 'id': 42}).encode())),
1414
(False, ('POST', '/jsonrpc', b'<?xml version="1.0"?><methodCall><methodName>test_method</methodName><params><param><value></value></param></params></methodCall>')),
@@ -28,7 +28,7 @@ def test_xml_rpc(self) -> None:
2828

2929
self.assertEqual(expected, xml_rpc('test_method')(request))
3030

31-
def test_json_rpc(self) -> None:
31+
def test_json_rpc(self):
3232
assertions = [
3333
(False, ('POST', '/rpc2', b'<?xml version="1.0"?><methodCall><methodName>test_method</methodName><params><param><value></value></param></params></methodCall>')),
3434
(False, ('POST', '/rpc2', json.dumps({'method': 'test_method', 'version': '1.1', 'params': [], 'id': 42}).encode())),

tests/test_xml_rpc_request.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66

77
class TestSipgateXmlRpcRequest(TestCase):
8-
def test_empty_body(self) -> None:
8+
def test_empty_body(self):
99
with self.assertRaises(ParseError):
1010
XmlRpcRequest.parse('')
1111

12-
def test_non_xml_body(self) -> None:
12+
def test_non_xml_body(self):
1313
with self.assertRaises(ParseError):
1414
XmlRpcRequest.parse("{'key': 'value'}")
1515

16-
def test_response_is_not_parsed_as_request(self) -> None:
16+
def test_response_is_not_parsed_as_request(self):
1717
body = """<?xml version="1.0" encoding="UTF-8"?>
1818
<methodResponse>
1919
<params><param><value>
@@ -27,7 +27,7 @@ def test_response_is_not_parsed_as_request(self) -> None:
2727
with self.assertRaises(ValueError):
2828
XmlRpcRequest.parse(body)
2929

30-
def test_method_name(self) -> None:
30+
def test_method_name(self):
3131
body = """<?xml version="1.0"?>
3232
<methodCall>
3333
<methodName>a_method_name</methodName>
@@ -37,7 +37,7 @@ def test_method_name(self) -> None:
3737
parsed = XmlRpcRequest.parse(body)
3838
self.assertEqual('a_method_name', parsed.method_name)
3939

40-
def test_valid_members(self) -> None:
40+
def test_valid_members(self):
4141
body = """<?xml version="1.0"?>
4242
<methodCall>
4343
<methodName>a_method_name</methodName>
@@ -69,7 +69,7 @@ def test_valid_members(self) -> None:
6969
self.assertEqual(b'', parsed.members['base64_empty'])
7070
self.assertEqual(b'any_data', parsed.members['base64_data'])
7171

72-
def test_invalid_members(self) -> None:
72+
def test_invalid_members(self):
7373
members = [
7474
{'name': 'bool_empty', 'value': '<boolean></boolean>'},
7575
{'name': 'bool_string', 'value': '<boolean>true</boolean>'},
@@ -92,7 +92,7 @@ def test_invalid_members(self) -> None:
9292
with self.assertRaises(ValueError):
9393
XmlRpcRequest.parse(body)
9494

95-
def test_unsupported_data_type(self) -> None:
95+
def test_unsupported_data_type(self):
9696
body = """<?xml version="1.0"?>
9797
<methodCall>
9898
<methodName>a_method_name</methodName>
@@ -106,7 +106,7 @@ def test_unsupported_data_type(self) -> None:
106106
with self.assertRaises(NotImplementedError):
107107
XmlRpcRequest.parse(body)
108108

109-
def test_has_string_representation(self) -> None:
109+
def test_has_string_representation(self):
110110
body = """<?xml version="1.0"?>
111111
<methodCall>
112112
<methodName>another_method_name</methodName>
@@ -122,7 +122,7 @@ def test_has_string_representation(self) -> None:
122122
self.assertIn('TNB', f"{parsed}")
123123
self.assertIn('D111', f"{parsed}")
124124

125-
def test_also_accepts_bytes(self) -> None:
125+
def test_also_accepts_bytes(self):
126126
body = b"""<?xml version="1.0"?>
127127
<methodCall>
128128
<methodName>a_method_name</methodName>
@@ -131,7 +131,7 @@ def test_also_accepts_bytes(self) -> None:
131131

132132
XmlRpcRequest.parse(body)
133133

134-
def test_serialization_empty_request(self) -> None:
134+
def test_serialization_empty_request(self):
135135
request = XmlRpcRequest('a_method', {})
136136

137137
expected_body = """<?xml version="1.0"?>
@@ -143,7 +143,7 @@ def test_serialization_empty_request(self) -> None:
143143
# TODO: use better comparison, this would ignore spaces in values
144144
self.assertEqual(''.join(expected_body.split()), ''.join(request.serialize().split()))
145145

146-
def test_serialization(self) -> None:
146+
def test_serialization(self):
147147
request = XmlRpcRequest('a_method', {
148148
'an_int': 42,
149149
'a_string': 'the_value',

tests/test_xml_rpc_response.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66

77
class TestSipgateXmlRpcResponse(TestCase):
8-
def test_empty_body(self) -> None:
8+
def test_empty_body(self):
99
with self.assertRaises(ParseError):
1010
XmlRpcResponse.parse('')
1111

12-
def test_non_xml_body(self) -> None:
12+
def test_non_xml_body(self):
1313
with self.assertRaises(ParseError):
1414
XmlRpcResponse.parse("{'key': 'value'}")
1515

16-
def test_request_is_not_parsed_as_response(self) -> None:
16+
def test_request_is_not_parsed_as_response(self):
1717
body = """<?xml version="1.0" encoding="UTF-8"?>
1818
<methodCall>
1919
<methodName>another_method_name</methodName>
@@ -27,7 +27,7 @@ def test_request_is_not_parsed_as_response(self) -> None:
2727
with self.assertRaises(ValueError):
2828
XmlRpcResponse.parse(body)
2929

30-
def test_parses_complex_success_response(self) -> None:
30+
def test_parses_complex_success_response(self):
3131
body = """<?xml version="1.0"?>
3232
<methodResponse>
3333
<params>
@@ -80,7 +80,7 @@ def test_parses_complex_success_response(self) -> None:
8080
'number': '0777',
8181
}], parsed.members['blocks'])
8282

83-
def test_parses_complex_error_response(self) -> None:
83+
def test_parses_complex_error_response(self):
8484
body = """<?xml version="1.0"?>
8585
<methodResponse>
8686
<fault><value>
@@ -104,7 +104,7 @@ def test_parses_complex_error_response(self) -> None:
104104
self.assertEqual((423, 'NOT_OK'), (parsed.fault_code, parsed.fault_string))
105105
self.assertTrue(['one', 'two'], parsed.members['things_that_went_wrong'])
106106

107-
def test_invalid_members(self) -> None:
107+
def test_invalid_members(self):
108108
members = [
109109
{'name': 'bool_empty', 'value': '<boolean></boolean>'},
110110
{'name': 'bool_string', 'value': '<boolean>true</boolean>'},
@@ -126,7 +126,7 @@ def test_invalid_members(self) -> None:
126126
with self.assertRaises(ValueError):
127127
XmlRpcResponse.parse(body)
128128

129-
def test_call_has_string_representation(self) -> None:
129+
def test_call_has_string_representation(self):
130130
body = """<?xml version="1.0"?>
131131
<methodResponse>
132132
<params>
@@ -142,7 +142,7 @@ def test_call_has_string_representation(self) -> None:
142142
parsed = XmlRpcResponse.parse(body)
143143
self.assertRegex(f"{parsed}", '^<XmlRpcResponse.*faultCode.*200.*>$')
144144

145-
def test_serialization_success_response(self) -> None:
145+
def test_serialization_success_response(self):
146146
response = XmlRpcResponse(200, 'OK')
147147

148148
expected_body = """<?xml version="1.0"?>
@@ -161,7 +161,7 @@ def test_serialization_success_response(self) -> None:
161161
# this would ignore spaces in values and does not ignore order of params
162162
self.assertEqual(''.join(expected_body.split()), ''.join(response.serialize().split()))
163163

164-
def test_serialization_fault_response(self) -> None:
164+
def test_serialization_fault_response(self):
165165
response = XmlRpcResponse(407, 'NOT SO OKAY')
166166

167167
expected_body = """<?xml version="1.0"?>
@@ -178,7 +178,7 @@ def test_serialization_fault_response(self) -> None:
178178
# this would ignore spaces in values and does not ignore order of params
179179
self.assertEqual(''.join(expected_body.split()), ''.join(response.serialize().split()))
180180

181-
def test_serialization(self) -> None:
181+
def test_serialization(self):
182182
response = XmlRpcResponse(200, 'OK', {
183183
'an_int': 42,
184184
'a_string': 'the_value',

0 commit comments

Comments
 (0)