Skip to content
Closed
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
3 changes: 1 addition & 2 deletions .github/workflows/test-lang-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
- '8'
- '11'
- '17'
- '18'
- '19'
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -152,4 +151,4 @@ jobs:

- name: Test Reproducible Build
working-directory: .
run: mvn clean verify -DskipTests artifact:compare
run: mvn clean verify -DskipTests -Dcyclonedx.skip artifact:compare
4 changes: 2 additions & 2 deletions lang/py/avro/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def write_decimal_bytes(self, datum: decimal.Decimal, scale: int) -> None:
signed long is 8, 8 bytes are written.
"""
sign, digits, exp = datum.as_tuple()
if (-1 * exp) > scale:
if (-1 * int(exp)) > scale:
raise avro.errors.AvroOutOfScaleException(scale, datum, exp)

unscaled_datum = 0
Expand All @@ -508,7 +508,7 @@ def write_decimal_fixed(self, datum: decimal.Decimal, scale: int, size: int) ->
Decimal in fixed are encoded as size of fixed bytes.
"""
sign, digits, exp = datum.as_tuple()
if (-1 * exp) > scale:
if (-1 * int(exp)) > scale:
raise avro.errors.AvroOutOfScaleException(scale, datum, exp)

unscaled_datum = 0
Expand Down
14 changes: 7 additions & 7 deletions lang/py/avro/test/test_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def test_schema_compatibility(self):
(WITHOUT_NAMESPACE_RECORD, WITH_NAMESPACE_RECORD),
]

for (reader, writer) in compatible_reader_writer_test_cases:
for reader, writer in compatible_reader_writer_test_cases:
self.assertTrue(self.are_compatible(reader, writer))

def test_schema_compatibility_fixed_size_mismatch(self):
Expand All @@ -711,7 +711,7 @@ def test_schema_compatibility_fixed_size_mismatch(self):
"/fields/1/type/size",
),
]
for (reader, writer, message, location) in incompatible_fixed_pairs:
for reader, writer, message, location in incompatible_fixed_pairs:
result = ReaderWriterCompatibilityChecker().get_compatibility(reader, writer)
self.assertIs(result.compatibility, SchemaCompatibilityType.incompatible)
self.assertIn(
Expand All @@ -737,7 +737,7 @@ def test_schema_compatibility_missing_enum_symbols(self):
"/fields/0/type/symbols",
),
]
for (reader, writer, message, location) in incompatible_pairs:
for reader, writer, message, location in incompatible_pairs:
result = ReaderWriterCompatibilityChecker().get_compatibility(reader, writer)
self.assertIs(result.compatibility, SchemaCompatibilityType.incompatible)
self.assertIn(message, result.messages)
Expand Down Expand Up @@ -853,7 +853,7 @@ def test_schema_compatibility_missing_union_branch(self):
),
]

for (reader, writer, message, location) in incompatible_pairs:
for reader, writer, message, location in incompatible_pairs:
result = ReaderWriterCompatibilityChecker().get_compatibility(reader, writer)
self.assertIs(result.compatibility, SchemaCompatibilityType.incompatible)
self.assertEqual(result.messages, message)
Expand All @@ -872,7 +872,7 @@ def test_schema_compatibility_name_mismatch(self):
),
]

for (reader, writer, message, location) in incompatible_pairs:
for reader, writer, message, location in incompatible_pairs:
result = ReaderWriterCompatibilityChecker().get_compatibility(reader, writer)
self.assertIs(result.compatibility, SchemaCompatibilityType.incompatible)
self.assertIn(message, result.messages)
Expand All @@ -883,7 +883,7 @@ def test_schema_compatibility_reader_field_missing_default_value(self):
(A_INT_RECORD1, EMPTY_RECORD1, "a", "/fields/0"),
(A_INT_B_DINT_RECORD1, EMPTY_RECORD1, "a", "/fields/0"),
]
for (reader, writer, message, location) in incompatible_pairs:
for reader, writer, message, location in incompatible_pairs:
result = ReaderWriterCompatibilityChecker().get_compatibility(reader, writer)
self.assertIs(result.compatibility, SchemaCompatibilityType.incompatible)
self.assertEqual(len(result.messages), 1)
Expand Down Expand Up @@ -1063,7 +1063,7 @@ def test_schema_compatibility_type_mismatch(self):
"/",
),
]
for (reader, writer, message, location) in incompatible_pairs:
for reader, writer, message, location in incompatible_pairs:
result = ReaderWriterCompatibilityChecker().get_compatibility(reader, writer)
self.assertIs(result.compatibility, SchemaCompatibilityType.incompatible)
self.assertIn(message, result.messages)
Expand Down
1 change: 0 additions & 1 deletion lang/py/avro/test/test_datafile_interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def test_interop(self) -> None:
continue
i = None
with self.subTest(filename=filename), avro.datafile.DataFileReader(filename.open("rb"), avro.io.DatumReader()) as dfr:

user_metadata = dfr.get_meta("user_metadata")
if user_metadata is not None:
self.assertEqual(user_metadata, b"someByteArray")
Expand Down
5 changes: 2 additions & 3 deletions lang/py/avro/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ def check_default_value(self) -> None:

class TestIncompatibleSchemaReading(unittest.TestCase):
def test_deserialization_fails(self) -> None:

reader_schema = avro.schema.parse(
json.dumps(
{
Expand Down Expand Up @@ -505,7 +504,7 @@ def test_decimal_bytes_small_scale(self) -> None:
"""Avro should raise an AvroTypeException when attempting to write a decimal with a larger exponent than the schema's scale."""
datum = decimal.Decimal("3.1415")
_, _, exp = datum.as_tuple()
scale = -1 * exp - 1
scale = -1 * int(exp) - 1
schema = avro.schema.parse(
json.dumps(
{
Expand All @@ -522,7 +521,7 @@ def test_decimal_fixed_small_scale(self) -> None:
"""Avro should raise an AvroTypeException when attempting to write a decimal with a larger exponent than the schema's scale."""
datum = decimal.Decimal("3.1415")
_, _, exp = datum.as_tuple()
scale = -1 * exp - 1
scale = -1 * int(exp) - 1
schema = avro.schema.parse(
json.dumps(
{
Expand Down
2 changes: 1 addition & 1 deletion lang/py/avro/test/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def parse_valid(self) -> None:
try:
warnings.filterwarnings(action="error", category=avro.errors.IgnoredLogicalType)
self.test_schema.parse()
except (avro.errors.IgnoredLogicalType) as e:
except avro.errors.IgnoredLogicalType as e:
self.assertIn(type(e), (type(w) for w in test_warnings))
self.assertIn(str(e), (str(w) for w in test_warnings))
except (avro.errors.AvroException, avro.errors.SchemaParseException): # pragma: no coverage
Expand Down
2 changes: 0 additions & 2 deletions lang/py/avro/tether/tether_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ def configure(self, taskType, inSchemaText, outSchemaText):
self._red_fkeys = [f.name for f in self.midschema.fields if not (f.order == "ignore")]

except Exception as e:

estr = traceback.format_exc()
self.fail(estr)

Expand Down Expand Up @@ -335,7 +334,6 @@ def input(self, data, count):
self.map(inRecord, self.midCollector)

elif self.taskType == TaskType.REDUCE:

# store the previous record
prev = self.midRecord

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<maven-remote-resources-plugin.version>3.0.0</maven-remote-resources-plugin.version>
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<plugin-tools-javadoc.version>3.7.0</plugin-tools-javadoc.version>
<plugin-tools-javadoc.version>3.5.2</plugin-tools-javadoc.version>
<spotless-maven-plugin.version>2.27.2</spotless-maven-plugin.version>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>

Expand Down