You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2022/09/13 20:36:59 UTC

[GitHub] [avro] github-code-scanning[bot] commented on a diff in pull request #1181: AVRO-1938: Add fingerprinting support to Python implementation

github-code-scanning[bot] commented on code in PR #1181:
URL: https://github.com/apache/avro/pull/1181#discussion_r970060629


##########
lang/py/avro/test/test_schema.py:
##########
@@ -722,12 +921,28 @@
     def test_parse_invalid_symbol(self):
         """Disabling enumschema symbol validation should allow invalid symbols to pass."""
         test_schema_string = json.dumps({"type": "enum", "name": "AVRO2174", "symbols": ["white space"]})
-        with self.assertRaises(avro.errors.InvalidName, msg="When enum symbol validation is enabled, an invalid symbol should raise InvalidName."):
-            avro.schema.parse(test_schema_string, validate_enum_symbols=True)
+
         try:
-            avro.schema.parse(test_schema_string, validate_enum_symbols=False)
-        except avro.errors.InvalidName:  # pragma: no coverage
-            self.fail("When enum symbol validation is disabled, an invalid symbol should not raise InvalidName.")
+            case = avro.schema.parse(test_schema_string, validate_enum_symbols=True)

Review Comment:
   ## Variable defined multiple times
   
   This assignment to 'case' is unnecessary as it is redefined [here](1) before this value is used.
   
   [Show more details](https://github.com/apache/avro/security/code-scanning/483)



##########
lang/py/avro/test/test_schema.py:
##########
@@ -722,12 +921,28 @@
     def test_parse_invalid_symbol(self):
         """Disabling enumschema symbol validation should allow invalid symbols to pass."""
         test_schema_string = json.dumps({"type": "enum", "name": "AVRO2174", "symbols": ["white space"]})
-        with self.assertRaises(avro.errors.InvalidName, msg="When enum symbol validation is enabled, an invalid symbol should raise InvalidName."):
-            avro.schema.parse(test_schema_string, validate_enum_symbols=True)
+
         try:
-            avro.schema.parse(test_schema_string, validate_enum_symbols=False)
-        except avro.errors.InvalidName:  # pragma: no coverage
-            self.fail("When enum symbol validation is disabled, an invalid symbol should not raise InvalidName.")
+            case = avro.schema.parse(test_schema_string, validate_enum_symbols=True)
+        except avro.errors.InvalidName:
+            pass
+        else:
+            self.fail("When enum symbol validation is enabled, " "an invalid symbol should raise InvalidName.")
+
+        try:
+            case = avro.schema.parse(test_schema_string, validate_enum_symbols=False)

Review Comment:
   ## Unused local variable
   
   The value assigned to local variable 'case' is never used.
   
   [Show more details](https://github.com/apache/avro/security/code-scanning/501)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@avro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org