]> git.madduck.net Git - etc/vim.git/blob - tests/data/comments4.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add `version` to github action (and rewrite the whole thing while at it) (#1940)
[etc/vim.git] / tests / data / comments4.py
1 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
2     MyLovelyCompanyTeamProjectComponent,  # NOT DRY
3 )
4 from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import (
5     MyLovelyCompanyTeamProjectComponent as component,  # DRY
6 )
7
8
9 class C:
10     @pytest.mark.parametrize(
11         ("post_data", "message"),
12         [
13             # metadata_version errors.
14             (
15                 {},
16                 "None is an invalid value for Metadata-Version. Error: This field is"
17                 " required. see"
18                 " https://packaging.python.org/specifications/core-metadata",
19             ),
20             (
21                 {"metadata_version": "-1"},
22                 "'-1' is an invalid value for Metadata-Version. Error: Unknown Metadata"
23                 " Version see"
24                 " https://packaging.python.org/specifications/core-metadata",
25             ),
26             # name errors.
27             (
28                 {"metadata_version": "1.2"},
29                 "'' is an invalid value for Name. Error: This field is required. see"
30                 " https://packaging.python.org/specifications/core-metadata",
31             ),
32             (
33                 {"metadata_version": "1.2", "name": "foo-"},
34                 "'foo-' is an invalid value for Name. Error: Must start and end with a"
35                 " letter or numeral and contain only ascii numeric and '.', '_' and"
36                 " '-'. see https://packaging.python.org/specifications/core-metadata",
37             ),
38             # version errors.
39             (
40                 {"metadata_version": "1.2", "name": "example"},
41                 "'' is an invalid value for Version. Error: This field is required. see"
42                 " https://packaging.python.org/specifications/core-metadata",
43             ),
44             (
45                 {"metadata_version": "1.2", "name": "example", "version": "dog"},
46                 "'dog' is an invalid value for Version. Error: Must start and end with"
47                 " a letter or numeral and contain only ascii numeric and '.', '_' and"
48                 " '-'. see https://packaging.python.org/specifications/core-metadata",
49             ),
50         ],
51     )
52     def test_fails_invalid_post_data(
53         self, pyramid_config, db_request, post_data, message
54     ):
55         pyramid_config.testing_securitypolicy(userid=1)
56         db_request.POST = MultiDict(post_data)
57
58
59 def foo(list_a, list_b):
60     results = (
61         User.query.filter(User.foo == "bar")
62         .filter(  # Because foo.
63             db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
64         )
65         .filter(User.xyz.is_(None))
66         # Another comment about the filtering on is_quux goes here.
67         .filter(db.not_(User.is_pending.astext.cast(db.Boolean).is_(True)))
68         .order_by(User.created_at.desc())
69         .with_for_update(key_share=True)
70         .all()
71     )
72     return results
73
74
75 def foo2(list_a, list_b):
76     # Standalone comment reasonably placed.
77     return (
78         User.query.filter(User.foo == "bar")
79         .filter(
80             db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
81         )
82         .filter(User.xyz.is_(None))
83     )
84
85
86 def foo3(list_a, list_b):
87     return (
88         # Standlone comment but weirdly placed.
89         User.query.filter(User.foo == "bar")
90         .filter(
91             db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
92         )
93         .filter(User.xyz.is_(None))
94     )