]> git.madduck.net Git - etc/vim.git/blob - tests/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:

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