Skip to content

Commit 98f296d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 01d219f commit 98f296d

File tree

2 files changed

+88
-93
lines changed

2 files changed

+88
-93
lines changed

cloudevents/tests/test_pydantic_cloudevent.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
import pytest
1818
from pydantic import ValidationError
19+
1920
import cloudevents.exceptions as cloud_exceptions
20-
from cloudevents.pydantic import CloudEvent
2121
from cloudevents.http.util import _json_or_string
22+
from cloudevents.pydantic import CloudEvent
2223

2324
_DUMMY_SOURCE = "dummy:source"
2425
_DUMMY_TYPE = "tests.cloudevents.override"
@@ -233,15 +234,9 @@ def test_json_data_serialization_with_explicit_json_content_type(
233234
dummy_attributes, json_content_type
234235
):
235236
dummy_attributes["datacontenttype"] = json_content_type
236-
assert (
237-
loads(
238-
CloudEvent(
239-
dummy_attributes,
240-
data='{"hello": "world"}',
241-
).json()
242-
)["data"]
243-
== {"hello": "world"}
244-
)
237+
assert loads(CloudEvent(dummy_attributes, data='{"hello": "world"}',).json())[
238+
"data"
239+
] == {"hello": "world"}
245240

246241

247242
@pytest.fixture(

cloudevents/tests/test_pydantic_event_attribute_types.py

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,103 +3,103 @@
33

44
from cloudevents.pydantic.event_attribute_types import (
55
AbsoluteURI,
6-
URIReference,
7-
NonEmptyURIReference,
8-
NonEmptyAbsoluteURI,
96
ContentType,
7+
NonEmptyAbsoluteURI,
8+
NonEmptyURIReference,
9+
URIReference,
1010
)
1111

1212
ABSOLUTE_URIS = [
13-
u"urn:uuid:1ca85b01-40e5-44e7-8669-04d85c615a7c",
14-
u"ftp://1.1.1.1/asdasd",
15-
u"http://foobar.dk",
16-
u"http://foobar.museum/foobar",
17-
u"http://fo.com",
18-
u"http://FOO.com",
19-
u"http://foo.com/blah_blah",
20-
u"http://foo.com/blah_blah/",
21-
u"http://foo.com/blah_blah_(wikipedia)",
22-
u"http://foo.com/blah_blah_(wikipedia)_(again)",
23-
u"http://www.example.com/wpstyle/?p=364",
24-
u"https://www.example.com/foo/?bar=baz&inga=42&quux",
25-
u"https://www.example.com?bar=baz",
26-
u"http://userid:[email protected]:8080",
27-
u"http://userid:[email protected]:8080/",
28-
u"http://[email protected]",
29-
u"http://[email protected]/",
30-
u"http://[email protected]:8080",
31-
u"http://[email protected]:8080/",
32-
u"http://userid:[email protected]",
33-
u"http://userid:[email protected]/",
34-
u"http://142.42.1.1/",
35-
u"http://142.42.1.1:8080/",
36-
u"http://foo.com/blah_(wikipedia)#cite-1",
37-
u"http://foo.com/blah_(wikipedia)_blah#cite-1",
38-
u"http://foo.com/(something)?after=parens",
39-
u"http://code.google.com/events/#&product=browser",
40-
u"http://j.mp",
41-
u"ftp://foo.bar/baz",
42-
u"http://foo.bar/?q=Test%20URL-encoded%20stuff",
43-
u"http://xn--d5b6ci4b4b3a.xn--54b7fta0cc",
44-
u"http://xn----gtbybh.xn--p1ai/1/asdf",
45-
u"http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
46-
u"http://1337.net",
47-
u"http://a.b-c.de",
48-
u"http://223.255.255.254",
49-
u"http://10.1.1.0",
50-
u"http://10.1.1.1",
51-
u"http://10.1.1.254",
52-
u"http://10.1.1.255",
53-
u"http://127.0.0.1:8080",
54-
u"http://127.0.10.150",
55-
u"http://localhost",
56-
u"http://localhost:8000",
57-
u"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html",
58-
u"http://[1080:0:0:0:8:800:200C:417A]/index.html",
59-
u"http://[3ffe:2a00:100:7031::1]",
60-
u"http://[1080::8:800:200C:417A]/foo",
61-
u"http://[::192.9.5.5]/ipng",
62-
u"http://[::FFFF:129.144.52.38]:80/index.html",
63-
u"http://[2010:836B:4179::836B:4179]",
13+
"urn:uuid:1ca85b01-40e5-44e7-8669-04d85c615a7c",
14+
"ftp://1.1.1.1/asdasd",
15+
"http://foobar.dk",
16+
"http://foobar.museum/foobar",
17+
"http://fo.com",
18+
"http://FOO.com",
19+
"http://foo.com/blah_blah",
20+
"http://foo.com/blah_blah/",
21+
"http://foo.com/blah_blah_(wikipedia)",
22+
"http://foo.com/blah_blah_(wikipedia)_(again)",
23+
"http://www.example.com/wpstyle/?p=364",
24+
"https://www.example.com/foo/?bar=baz&inga=42&quux",
25+
"https://www.example.com?bar=baz",
26+
"http://userid:[email protected]:8080",
27+
"http://userid:[email protected]:8080/",
28+
29+
"http://[email protected]/",
30+
"http://[email protected]:8080",
31+
"http://[email protected]:8080/",
32+
"http://userid:[email protected]",
33+
"http://userid:[email protected]/",
34+
"http://142.42.1.1/",
35+
"http://142.42.1.1:8080/",
36+
"http://foo.com/blah_(wikipedia)#cite-1",
37+
"http://foo.com/blah_(wikipedia)_blah#cite-1",
38+
"http://foo.com/(something)?after=parens",
39+
"http://code.google.com/events/#&product=browser",
40+
"http://j.mp",
41+
"ftp://foo.bar/baz",
42+
"http://foo.bar/?q=Test%20URL-encoded%20stuff",
43+
"http://xn--d5b6ci4b4b3a.xn--54b7fta0cc",
44+
"http://xn----gtbybh.xn--p1ai/1/asdf",
45+
"http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com",
46+
"http://1337.net",
47+
"http://a.b-c.de",
48+
"http://223.255.255.254",
49+
"http://10.1.1.0",
50+
"http://10.1.1.1",
51+
"http://10.1.1.254",
52+
"http://10.1.1.255",
53+
"http://127.0.0.1:8080",
54+
"http://127.0.10.150",
55+
"http://localhost",
56+
"http://localhost:8000",
57+
"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html",
58+
"http://[1080:0:0:0:8:800:200C:417A]/index.html",
59+
"http://[3ffe:2a00:100:7031::1]",
60+
"http://[1080::8:800:200C:417A]/foo",
61+
"http://[::192.9.5.5]/ipng",
62+
"http://[::FFFF:129.144.52.38]:80/index.html",
63+
"http://[2010:836B:4179::836B:4179]",
6464
]
6565
NON_ABSOLUTE_URI_REFERENCES = [
66-
u"foo.com/blah_(wikipedia)_blah#cite-1",
67-
u"foo.com/(something)?after=parens",
68-
u"damowmow.com/",
69-
u"code.google.com/events/#&product=browser",
70-
u"j.mp",
71-
u"foo.bar/baz",
72-
u"foo.bar/?q=Test%20URL-encoded%20stuff",
73-
u"xn--d5b6ci4b4b3a.xn--54b7fta0cc",
74-
u"xn----gtbybh.xn--p1ai/1/asdf",
66+
"foo.com/blah_(wikipedia)_blah#cite-1",
67+
"foo.com/(something)?after=parens",
68+
"damowmow.com/",
69+
"code.google.com/events/#&product=browser",
70+
"j.mp",
71+
"foo.bar/baz",
72+
"foo.bar/?q=Test%20URL-encoded%20stuff",
73+
"xn--d5b6ci4b4b3a.xn--54b7fta0cc",
74+
"xn----gtbybh.xn--p1ai/1/asdf",
7575
]
7676

7777
NON_URI_STRINGS = [
78-
u"http://☺.damowmow.com/",
79-
u"http://➡.ws/䨹",
80-
u"http://⌘.ws",
81-
u"http://⌘.ws/",
78+
"http://☺.damowmow.com/",
79+
"http://➡.ws/䨹",
80+
"http://⌘.ws",
81+
"http://⌘.ws/",
8282
"a a",
8383
" ",
84-
u"unicode_(✪)_in_parens",
84+
"unicode_(✪)_in_parens",
8585
"http:// shouldfail.com",
8686
":// should fail",
8787
'http://example.com/">[email protected]',
88-
u"http://✪df.ws/123",
89-
u"дом-м.рф/1/asdf",
90-
u"http://مثال.إختبار",
91-
u"http://例子.测试",
92-
u"http://उदाहरण.परीक्षा",
93-
u"http://www.😉.com",
94-
u"http://😉.com/😁",
95-
u"http://উদাহরণ.বাংলা",
96-
u"مثال.إختبار",
97-
u"例子.测试",
98-
u"उदाहरण.परीक्षा",
99-
u"www.😉.com",
100-
u"com/😁",
101-
u"উদাহরণ.বাংলা",
102-
u"http://foo.com/unicode_(✪)_in_parens",
88+
"http://✪df.ws/123",
89+
"дом-м.рф/1/asdf",
90+
"http://مثال.إختبار",
91+
"http://例子.测试",
92+
"http://उदाहरण.परीक्षा",
93+
"http://www.😉.com",
94+
"http://😉.com/😁",
95+
"http://উদাহরণ.বাংলা",
96+
"مثال.إختبار",
97+
"例子.测试",
98+
"उदाहरण.परीक्षा",
99+
"www.😉.com",
100+
"com/😁",
101+
"উদাহরণ.বাংলা",
102+
"http://foo.com/unicode_(✪)_in_parens",
103103
]
104104

105105

0 commit comments

Comments
 (0)