@@ -233,7 +233,9 @@ def test_write_cloud_event_with_extension_attributes() -> None:
233233
234234
235235def test_read_cloud_event_with_extension_attributes () -> None :
236- data = '{"id": "123", "source": "source", "type": "type", "specversion": "1.0", "customext1": "value1", "customext2": 123}' .encode ("utf-8" )
236+ data = '{"id": "123", "source": "source", "type": "type", "specversion": "1.0", "customext1": "value1", "customext2": 123}' .encode (
237+ "utf-8"
238+ )
237239 formatter = JSONFormat ()
238240 result = formatter .read (CloudEvent , data )
239241
@@ -247,7 +249,7 @@ def test_write_cloud_event_with_different_json_content_types() -> None:
247249 ("text/json" , {"key" : "value" }),
248250 ("application/json; charset=utf-8" , {"key" : "value" }),
249251 ]
250-
252+
251253 for content_type , data in test_cases :
252254 attributes = {
253255 "id" : "123" ,
@@ -259,12 +261,14 @@ def test_write_cloud_event_with_different_json_content_types() -> None:
259261 event = CloudEvent (attributes = attributes , data = data )
260262 formatter = JSONFormat ()
261263 result = formatter .write (event )
262-
264+
263265 assert b'"data": {"key": "value"}' in result
264266
265267
266268def test_read_cloud_event_with_string_data () -> None :
267- data = '{"id": "123", "source": "source", "type": "type", "specversion": "1.0", "data": "plain string data"}' .encode ("utf-8" )
269+ data = '{"id": "123", "source": "source", "type": "type", "specversion": "1.0", "data": "plain string data"}' .encode (
270+ "utf-8"
271+ )
268272 formatter = JSONFormat ()
269273 result = formatter .read (CloudEvent , data )
270274
@@ -296,14 +300,16 @@ def test_write_cloud_event_with_unicode_data() -> None:
296300 event = CloudEvent (attributes = attributes , data = "Hello 世界 🌍" )
297301 formatter = JSONFormat ()
298302 result = formatter .write (event )
299-
303+
300304 decoded = result .decode ("utf-8" )
301305 assert '"data": "Hello' in decoded
302306 assert "Hello" in decoded
303307
304308
305309def test_read_cloud_event_with_unicode_data () -> None :
306- data = '{"id": "123", "source": "source", "type": "type", "specversion": "1.0", "data": "Hello 世界 🌍"}' .encode ("utf-8" )
310+ data = '{"id": "123", "source": "source", "type": "type", "specversion": "1.0", "data": "Hello 世界 🌍"}' .encode (
311+ "utf-8"
312+ )
307313 formatter = JSONFormat ()
308314 result = formatter .read (CloudEvent , data )
309315
0 commit comments