1515# SPDX-License-Identifier: Apache-2.0
1616# Copyright (c) OWASP Foundation. All Rights Reserved.
1717
18+ from collections .abc import Generator
1819from glob import iglob
1920from itertools import chain
2021from os .path import join
21- from typing import Generator
2222from unittest import TestCase
2323
2424from ddt import data , ddt , idata , unpack
@@ -69,7 +69,7 @@ def test_throws_with_unsupported_schema_version(self, schema_version: SchemaVers
6969 @unpack
7070 def test_validate_no_none (self , schema_version : SchemaVersion , test_data_file : str ) -> None :
7171 validator = JsonValidator (schema_version )
72- with open (join (test_data_file ), 'r' ) as tdfh :
72+ with open (join (test_data_file )) as tdfh :
7373 test_data = tdfh .read ()
7474 try :
7575 validation_error = validator .validate_str (test_data )
@@ -84,7 +84,7 @@ def test_validate_no_none(self, schema_version: SchemaVersion, test_data_file: s
8484 @unpack
8585 def test_validate_expected_error (self , schema_version : SchemaVersion , test_data_file : str ) -> None :
8686 validator = JsonValidator (schema_version )
87- with open (join (test_data_file ), 'r' ) as tdfh :
87+ with open (join (test_data_file )) as tdfh :
8888 test_data = tdfh .read ()
8989 try :
9090 validation_error = validator .validate_str (test_data )
@@ -109,7 +109,7 @@ def test_throws_with_unsupported_schema_version(self, schema_version: SchemaVers
109109 @unpack
110110 def test_validate_no_none (self , schema_version : SchemaVersion , test_data_file : str ) -> None :
111111 validator = JsonStrictValidator (schema_version )
112- with open (join (test_data_file ), 'r' ) as tdfh :
112+ with open (join (test_data_file )) as tdfh :
113113 test_data = tdfh .read ()
114114 try :
115115 validation_error = validator .validate_str (test_data )
@@ -124,7 +124,7 @@ def test_validate_no_none(self, schema_version: SchemaVersion, test_data_file: s
124124 @unpack
125125 def test_validate_expected_error (self , schema_version : SchemaVersion , test_data_file : str ) -> None :
126126 validator = JsonStrictValidator (schema_version )
127- with open (join (test_data_file ), 'r' ) as tdfh :
127+ with open (join (test_data_file )) as tdfh :
128128 test_data = tdfh .read ()
129129 try :
130130 validation_error = validator .validate_str (test_data )
0 commit comments