Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ ci:

repos:
- repo: https://github.com/pycqa/isort
rev: 5.11.5
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.10.0
hooks:
- id: black
args: ["--target-version", "py310"]

- repo: https://github.com/PyCQA/doc8
rev: 0.10.1
rev: v1.1.2
hooks:
- id: doc8
additional_dependencies:
Expand Down
12 changes: 6 additions & 6 deletions src/aristaproto/lib/pydantic/google/protobuf/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/aristaproto/lib/std/google/protobuf/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/aristaproto/lib/std/google/protobuf/compiler/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/aristaproto/plugin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
reference to `A` to `B`'s `fields` attribute.
"""


import builtins
import re
import textwrap
Expand Down
6 changes: 3 additions & 3 deletions src/aristaproto/plugin/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def generate_code(request: CodeGeneratorRequest) -> CodeGeneratorResponse:
request_data.output_packages[output_package_name].output = False

if "pydantic_dataclasses" in plugin_options:
request_data.output_packages[
output_package_name
].pydantic_dataclasses = True
request_data.output_packages[output_package_name].pydantic_dataclasses = (
True
)

# Read Messages and Enums
# We need to read Messages before Services in so that we can
Expand Down
63 changes: 36 additions & 27 deletions tests/test_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@


def test_load_varint_too_long():
with BytesIO(
b"\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01"
) as stream, pytest.raises(ValueError):
with (
BytesIO(b"\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01") as stream,
pytest.raises(ValueError),
):
aristaproto.load_varint(stream)

with BytesIO(b"\x80\x80\x80\x80\x80\x80\x80\x80\x80\x01") as stream:
Expand Down Expand Up @@ -83,9 +84,10 @@ def test_dump_varint_file(tmp_path):
aristaproto.dump_varint(123456789, stream) # Multi-byte varint

# Check that file contents are as expected
with open(tmp_path / "dump_varint_file.out", "rb") as test_stream, open(
streams_path / "message_dump_file_single.expected", "rb"
) as exp_stream:
with (
open(tmp_path / "dump_varint_file.out", "rb") as test_stream,
open(streams_path / "message_dump_file_single.expected", "rb") as exp_stream,
):
assert aristaproto.load_varint(test_stream) == aristaproto.load_varint(
exp_stream
)
Expand All @@ -111,9 +113,10 @@ def test_message_dump_file_single(tmp_path):
oneof_example.dump(stream)

# Check that the outputted file is exactly as expected
with open(tmp_path / "message_dump_file_single.out", "rb") as test_stream, open(
streams_path / "message_dump_file_single.expected", "rb"
) as exp_stream:
with (
open(tmp_path / "message_dump_file_single.out", "rb") as test_stream,
open(streams_path / "message_dump_file_single.expected", "rb") as exp_stream,
):
assert test_stream.read() == exp_stream.read()


Expand All @@ -125,9 +128,10 @@ def test_message_dump_file_multiple(tmp_path):
nested_example.dump(stream)

# Check that all three Messages were outputted to the file correctly
with open(tmp_path / "message_dump_file_multiple.out", "rb") as test_stream, open(
streams_path / "message_dump_file_multiple.expected", "rb"
) as exp_stream:
with (
open(tmp_path / "message_dump_file_multiple.out", "rb") as test_stream,
open(streams_path / "message_dump_file_multiple.expected", "rb") as exp_stream,
):
assert test_stream.read() == exp_stream.read()


Expand All @@ -137,9 +141,10 @@ def test_message_dump_delimited(tmp_path):
oneof_example.dump(stream, aristaproto.SIZE_DELIMITED)
nested_example.dump(stream, aristaproto.SIZE_DELIMITED)

with open(tmp_path / "message_dump_delimited.out", "rb") as test_stream, open(
streams_path / "delimited_messages.in", "rb"
) as exp_stream:
with (
open(tmp_path / "message_dump_delimited.out", "rb") as test_stream,
open(streams_path / "delimited_messages.in", "rb") as exp_stream,
):
assert test_stream.read() == exp_stream.read()


Expand All @@ -165,9 +170,10 @@ def test_message_load_file_multiple():


def test_message_load_too_small():
with open(
streams_path / "message_dump_file_single.expected", "rb"
) as stream, pytest.raises(ValueError):
with (
open(streams_path / "message_dump_file_single.expected", "rb") as stream,
pytest.raises(ValueError),
):
oneof.Test().load(stream, len_oneof - 1)


Expand All @@ -180,9 +186,10 @@ def test_message_load_delimited():


def test_message_load_too_large():
with open(
streams_path / "message_dump_file_single.expected", "rb"
) as stream, pytest.raises(ValueError):
with (
open(streams_path / "message_dump_file_single.expected", "rb") as stream,
pytest.raises(ValueError),
):
oneof.Test().load(stream, len_oneof + 1)


Expand Down Expand Up @@ -272,9 +279,10 @@ def test_dump_varint_negative(tmp_path):
with pytest.raises(ValueError):
aristaproto.dump_varint(beyond, stream)

with open(streams_path / "dump_varint_negative.expected", "rb") as exp_stream, open(
tmp_path / "dump_varint_negative.out", "rb"
) as test_stream:
with (
open(streams_path / "dump_varint_negative.expected", "rb") as exp_stream,
open(tmp_path / "dump_varint_negative.out", "rb") as test_stream,
):
assert test_stream.read() == exp_stream.read()


Expand All @@ -286,9 +294,10 @@ def test_dump_varint_positive(tmp_path):
aristaproto.dump_varint(single_byte, stream)
aristaproto.dump_varint(multi_byte, stream)

with open(tmp_path / "dump_varint_positive.out", "rb") as test_stream, open(
streams_path / "dump_varint_positive.expected", "rb"
) as exp_stream:
with (
open(tmp_path / "dump_varint_positive.out", "rb") as test_stream,
open(streams_path / "dump_varint_positive.expected", "rb") as exp_stream,
):
assert test_stream.read() == exp_stream.read()


Expand Down
Loading