Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 4cdba4d

Browse files
committed
chore: linting
1 parent 6ab9150 commit 4cdba4d

File tree

3 files changed

+15
-32
lines changed

3 files changed

+15
-32
lines changed

kiota_serialization_json/json_serialization_writer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def write_time_value(self, key: Optional[str], value: Optional[time]) -> None:
191191
raise ValueError("Invalid time string value found")
192192

193193
def write_collection_of_primitive_values(
194-
self, key: Optional[str], values: Optional[List[T]]
194+
self, key: Optional[str], values: Optional[List[T]]
195195
) -> None:
196196
"""Writes the specified collection of primitive values to the stream with an optional
197197
given key.
@@ -212,7 +212,7 @@ def write_collection_of_primitive_values(
212212
self.value = result
213213

214214
def write_collection_of_object_values(
215-
self, key: Optional[str], values: Optional[List[U]]
215+
self, key: Optional[str], values: Optional[List[U]]
216216
) -> None:
217217
"""Writes the specified collection of model objects to the stream with an optional
218218
given key.
@@ -233,7 +233,7 @@ def write_collection_of_object_values(
233233
self.value = obj_list
234234

235235
def write_collection_of_enum_values(
236-
self, key: Optional[str], values: Optional[List[Enum]]
236+
self, key: Optional[str], values: Optional[List[Enum]]
237237
) -> None:
238238
"""Writes the specified collection of enum values to the stream with an optional given key.
239239
Args:
@@ -253,7 +253,7 @@ def write_collection_of_enum_values(
253253
self.value = result
254254

255255
def __write_collection_of_dict_values(
256-
self, key: Optional[str], values: Optional[List[Dict[str, Any]]]
256+
self, key: Optional[str], values: Optional[List[Dict[str, Any]]]
257257
) -> None:
258258
"""Writes the specified collection of dictionary values to the stream with an optional
259259
given key.
@@ -290,7 +290,7 @@ def write_bytes_value(self, key: Optional[str], value: bytes) -> None:
290290
self.value = base64_string
291291

292292
def write_object_value(
293-
self, key: Optional[str], value: Optional[U], *additional_values_to_merge: U
293+
self, key: Optional[str], value: Optional[U], *additional_values_to_merge: U
294294
) -> None:
295295
"""Writes the specified model object to the stream with an optional given key.
296296
Args:
@@ -423,7 +423,7 @@ def on_after_object_serialization(self, value: Optional[Callable[[Parsable], Non
423423

424424
@property
425425
def on_start_object_serialization(
426-
self
426+
self
427427
) -> Optional[Callable[[Parsable, SerializationWriter], None]]:
428428
"""Gets the callback called right after the serialization process starts.
429429
Returns:
@@ -434,7 +434,7 @@ def on_start_object_serialization(
434434

435435
@on_start_object_serialization.setter
436436
def on_start_object_serialization(
437-
self, value: Optional[Callable[[Parsable, SerializationWriter], None]]
437+
self, value: Optional[Callable[[Parsable, SerializationWriter], None]]
438438
) -> None:
439439
"""Sets the callback called right after the serialization process starts.
440440
Args:

tests/unit/test_json_parse_node_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_get_root_parse_node(sample_json_string):
1818
assert isinstance(root, JsonParseNode)
1919
assert root._json_node == json.loads(sample_json_string)
2020

21-
21+
2222
def test_get_root_parse_node_no_content_type(sample_json_string):
2323
with pytest.raises(Exception) as e_info:
2424
factory = JsonParseNodeFactory()

tests/unit/test_json_serialization_writer.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def test_write_datetime_value():
100100

101101
def test_write_datetime_value_valid_string():
102102
json_serialization_writer = JsonSerializationWriter()
103-
json_serialization_writer.write_datetime_value(
104-
"updatedAt", "2022-01-27T12:59:45.596117"
105-
)
103+
json_serialization_writer.write_datetime_value("updatedAt", "2022-01-27T12:59:45.596117")
106104
content = json_serialization_writer.get_serialized_content()
107105
content_string = content.decode('utf-8')
108106
assert content_string == '{"updatedAt": "2022-01-27T12:59:45.596117+00:00"}'
@@ -111,17 +109,14 @@ def test_write_datetime_value_valid_string():
111109
def test_write_datetime_value_invalid_string():
112110
with pytest.raises(ValueError) as excinfo:
113111
json_serialization_writer = JsonSerializationWriter()
114-
json_serialization_writer.write_datetime_value(
115-
"updatedAt", "invalid-datetime-string"
116-
)
112+
json_serialization_writer.write_datetime_value("updatedAt", "invalid-datetime-string")
117113
assert "Invalid datetime string value found for property updatedAt" in str(excinfo.value)
118114

119115

120116
def test_write_timedelta_value():
121117
json_serialization_writer = JsonSerializationWriter()
122118
json_serialization_writer.write_timedelta_value(
123-
"diff",
124-
(
119+
"diff", (
125120
pendulum.parse('2022-01-27T12:59:45.596117') -
126121
pendulum.parse('2022-01-27T10:59:45.596117')
127122
).as_timedelta()
@@ -133,10 +128,7 @@ def test_write_timedelta_value():
133128

134129
def test_write_timedelta_value_valid_string():
135130
json_serialization_writer = JsonSerializationWriter()
136-
json_serialization_writer.write_timedelta_value(
137-
"diff",
138-
"2:00:00"
139-
)
131+
json_serialization_writer.write_timedelta_value("diff", "2:00:00")
140132
content = json_serialization_writer.get_serialized_content()
141133
content_string = content.decode('utf-8')
142134
assert content_string == '{"diff": "2:00:00"}'
@@ -145,10 +137,7 @@ def test_write_timedelta_value_valid_string():
145137
def test_write_timedelta_value_invalid_string():
146138
with pytest.raises(ValueError) as excinfo:
147139
json_serialization_writer = JsonSerializationWriter()
148-
json_serialization_writer.write_timedelta_value(
149-
"diff",
150-
"invalid-timedelta-string"
151-
)
140+
json_serialization_writer.write_timedelta_value("diff", "invalid-timedelta-string")
152141
assert "Invalid timedelta string value found for property diff" in str(excinfo.value)
153142

154143

@@ -188,10 +177,7 @@ def test_write_time_value():
188177

189178
def test_write_time_value_valid_string():
190179
json_serialization_writer = JsonSerializationWriter()
191-
json_serialization_writer.write_time_value(
192-
"time",
193-
"12:59:45.596117"
194-
)
180+
json_serialization_writer.write_time_value("time", "12:59:45.596117")
195181
content = json_serialization_writer.get_serialized_content()
196182
content_string = content.decode('utf-8')
197183
assert content_string == '{"time": "12:59:45.596117"}'
@@ -200,10 +186,7 @@ def test_write_time_value_valid_string():
200186
def test_write_time_value_invalid_string():
201187
with pytest.raises(ValueError) as excinfo:
202188
json_serialization_writer = JsonSerializationWriter()
203-
json_serialization_writer.write_time_value(
204-
"time",
205-
"invalid-time-string"
206-
)
189+
json_serialization_writer.write_time_value("time", "invalid-time-string")
207190
assert "Invalid time string value found for property time" in str(excinfo.value)
208191

209192

0 commit comments

Comments
 (0)