Codegen: fix autopep8 pre-commit hook

This commit is contained in:
Paolo Tranquilli
2023-03-29 15:57:45 +02:00
parent 48c2303391
commit 92197bf9f2
5 changed files with 64 additions and 59 deletions

View File

@@ -19,7 +19,7 @@ repos:
rev: v1.6.0
hooks:
- id: autopep8
files: ^swift/.*\.py
files: ^misc/codegen/.*\.py
- repo: local
hooks:

View File

@@ -94,6 +94,7 @@ class _Listifier(_schema.PropertyModifier):
raise _schema.Error(
"list should only be applied to simple or optional property types")
class _Setifier(_schema.PropertyModifier):
def modify(self, prop: _schema.Property):
K = _schema.Property.Kind

View File

@@ -36,6 +36,7 @@ indefinite_getters = [
("Whatever", "getAWhatever"),
]
@pytest.mark.parametrize("name,expected_getter", indefinite_getters)
def test_property_indefinite_article(name, expected_getter):
prop = ql.Property(name, plural="X")
@@ -47,6 +48,7 @@ def test_property_unordered_getter(name, expected_getter):
prop = ql.Property(name, plural="X", is_unordered=True)
assert prop.getter == expected_getter
@pytest.mark.parametrize("plural,expected", [
(None, False),
("", False),
@@ -56,6 +58,7 @@ def test_property_is_repeated(plural, expected):
prop = ql.Property("foo", "Foo", "props", ["result"], plural=plural)
assert prop.is_repeated is expected
@pytest.mark.parametrize("plural,unordered,expected", [
(None, False, False),
("", False, False),

View File

@@ -337,6 +337,7 @@ def test_repeated_property(generate_classes, is_child, prev_child):
])),
}
def test_repeated_unordered_property(generate_classes):
assert generate_classes([
schema.Class("FakeRoot"),