]> 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:

Simplify the #606 patch
[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. "
17                 "Error: This field is required. "
18                 "see "
19                 "https://packaging.python.org/specifications/core-metadata",
20             ),
21             (
22                 {"metadata_version": "-1"},
23                 "'-1' is an invalid value for Metadata-Version. "
24                 "Error: Unknown Metadata Version "
25                 "see "
26                 "https://packaging.python.org/specifications/core-metadata",
27             ),
28             # name errors.
29             (
30                 {"metadata_version": "1.2"},
31                 "'' is an invalid value for Name. "
32                 "Error: This field is required. "
33                 "see "
34                 "https://packaging.python.org/specifications/core-metadata",
35             ),
36             (
37                 {"metadata_version": "1.2", "name": "foo-"},
38                 "'foo-' is an invalid value for Name. "
39                 "Error: Must start and end with a letter or numeral and "
40                 "contain only ascii numeric and '.', '_' and '-'. "
41                 "see "
42                 "https://packaging.python.org/specifications/core-metadata",
43             ),
44             # version errors.
45             (
46                 {"metadata_version": "1.2", "name": "example"},
47                 "'' is an invalid value for Version. "
48                 "Error: This field is required. "
49                 "see "
50                 "https://packaging.python.org/specifications/core-metadata",
51             ),
52             (
53                 {"metadata_version": "1.2", "name": "example", "version": "dog"},
54                 "'dog' is an invalid value for Version. "
55                 "Error: Must start and end with a letter or numeral and "
56                 "contain only ascii numeric and '.', '_' and '-'. "
57                 "see "
58                 "https://packaging.python.org/specifications/core-metadata",
59             ),
60         ],
61     )
62     def test_fails_invalid_post_data(
63         self, pyramid_config, db_request, post_data, message
64     ):
65         pyramid_config.testing_securitypolicy(userid=1)
66         db_request.POST = MultiDict(post_data)
67
68
69 def foo(list_a, list_b):
70     results = (
71         User.query.filter(User.foo == "bar")
72         .filter(  # Because foo.
73             db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
74         )
75         .filter(User.xyz.is_(None))
76         # Another comment about the filtering on is_quux goes here.
77         .filter(db.not_(User.is_pending.astext.cast(db.Boolean).is_(True)))
78         .order_by(User.created_at.desc())
79         .with_for_update(key_share=True)
80         .all()
81     )
82     return results
83
84
85 def foo2(list_a, list_b):
86     # Standalone comment reasonably placed.
87     return (
88         User.query.filter(User.foo == "bar")
89         .filter(
90             db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
91         )
92         .filter(User.xyz.is_(None))
93     )
94
95
96 def foo3(list_a, list_b):
97     return (
98         # Standlone comment but weirdly placed.
99         User.query.filter(User.foo == "bar")
100         .filter(
101             db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
102         )
103         .filter(User.xyz.is_(None))
104     )