@@ -665,7 +665,7 @@ def test_infer_schema_multiple_datasets_with_default_slice(self):
665
665
self .assertEqual (actual_schema , expected_schema )
666
666
667
667
def test_infer_schema_invalid_statistics_input (self ):
668
- with self .assertRaisesRegexp (
668
+ with self .assertRaisesRegex (
669
669
TypeError , '.*should be a DatasetFeatureStatisticsList proto.*' ):
670
670
_ = validation_api .infer_schema ({})
671
671
@@ -675,7 +675,7 @@ def test_infer_schema_invalid_multiple_datasets_no_default_slice(self):
675
675
statistics_pb2 .DatasetFeatureStatistics (),
676
676
statistics_pb2 .DatasetFeatureStatistics ()
677
677
])
678
- with self .assertRaisesRegexp (ValueError ,
678
+ with self .assertRaisesRegex (ValueError ,
679
679
'.*statistics proto with one dataset.*' ):
680
680
_ = validation_api .infer_schema (statistics )
681
681
@@ -999,13 +999,13 @@ def test_update_schema_multiple_datasets_with_default_slice(self):
999
999
def test_update_schema_invalid_schema_input (self ):
1000
1000
statistics = statistics_pb2 .DatasetFeatureStatisticsList ()
1001
1001
statistics .datasets .extend ([statistics_pb2 .DatasetFeatureStatistics ()])
1002
- with self .assertRaisesRegexp (
1002
+ with self .assertRaisesRegex (
1003
1003
TypeError , 'schema is of type.*' ):
1004
1004
_ = validation_api .update_schema ({}, statistics )
1005
1005
1006
1006
def test_update_schema_invalid_statistics_input (self ):
1007
1007
schema = schema_pb2 .Schema ()
1008
- with self .assertRaisesRegexp (
1008
+ with self .assertRaisesRegex (
1009
1009
TypeError , 'statistics is of type.*' ):
1010
1010
_ = validation_api .update_schema (schema , {})
1011
1011
@@ -1016,7 +1016,7 @@ def test_update_schema_invalid_multiple_datasets_no_default_slice(self):
1016
1016
statistics_pb2 .DatasetFeatureStatistics (),
1017
1017
statistics_pb2 .DatasetFeatureStatistics ()
1018
1018
])
1019
- with self .assertRaisesRegexp (ValueError ,
1019
+ with self .assertRaisesRegex (ValueError ,
1020
1020
'.*statistics proto with one dataset.*' ):
1021
1021
_ = validation_api .update_schema (schema , statistics )
1022
1022
@@ -1956,15 +1956,15 @@ def test_validate_stats_with_previous_and_serving_stats_with_default_slices(
1956
1956
1957
1957
def test_validate_stats_invalid_statistics_input (self ):
1958
1958
schema = schema_pb2 .Schema ()
1959
- with self .assertRaisesRegexp (
1959
+ with self .assertRaisesRegex (
1960
1960
TypeError , 'statistics is of type.*' ):
1961
1961
_ = validation_api .validate_statistics ({}, schema )
1962
1962
1963
1963
def test_validate_stats_invalid_previous_statistics_input (self ):
1964
1964
statistics = statistics_pb2 .DatasetFeatureStatisticsList ()
1965
1965
statistics .datasets .extend ([statistics_pb2 .DatasetFeatureStatistics ()])
1966
1966
schema = schema_pb2 .Schema ()
1967
- with self .assertRaisesRegexp (
1967
+ with self .assertRaisesRegex (
1968
1968
TypeError , 'previous_statistics is of type.*' ):
1969
1969
_ = validation_api .validate_statistics (statistics , schema ,
1970
1970
previous_statistics = 'test' )
@@ -1973,7 +1973,7 @@ def test_validate_stats_internal_invalid_previous_span_statistics_input(self):
1973
1973
statistics = statistics_pb2 .DatasetFeatureStatisticsList ()
1974
1974
statistics .datasets .extend ([statistics_pb2 .DatasetFeatureStatistics ()])
1975
1975
schema = schema_pb2 .Schema ()
1976
- with self .assertRaisesRegexp (TypeError ,
1976
+ with self .assertRaisesRegex (TypeError ,
1977
1977
'previous_span_statistics is of type.*' ):
1978
1978
_ = validation_api .validate_statistics_internal (
1979
1979
statistics , schema , previous_span_statistics = 'test' )
@@ -1982,7 +1982,7 @@ def test_validate_stats_invalid_serving_statistics_input(self):
1982
1982
statistics = statistics_pb2 .DatasetFeatureStatisticsList ()
1983
1983
statistics .datasets .extend ([statistics_pb2 .DatasetFeatureStatistics ()])
1984
1984
schema = schema_pb2 .Schema ()
1985
- with self .assertRaisesRegexp (
1985
+ with self .assertRaisesRegex (
1986
1986
TypeError , 'serving_statistics is of type.*' ):
1987
1987
_ = validation_api .validate_statistics (statistics , schema ,
1988
1988
serving_statistics = 'test' )
@@ -1991,15 +1991,15 @@ def test_validate_stats_invalid_previous_version_statistics_input(self):
1991
1991
statistics = statistics_pb2 .DatasetFeatureStatisticsList ()
1992
1992
statistics .datasets .extend ([statistics_pb2 .DatasetFeatureStatistics ()])
1993
1993
schema = schema_pb2 .Schema ()
1994
- with self .assertRaisesRegexp (TypeError ,
1994
+ with self .assertRaisesRegex (TypeError ,
1995
1995
'previous_version_statistics is of type.*' ):
1996
1996
_ = validation_api .validate_statistics_internal (
1997
1997
statistics , schema , previous_version_statistics = 'test' )
1998
1998
1999
1999
def test_validate_stats_invalid_schema_input (self ):
2000
2000
statistics = statistics_pb2 .DatasetFeatureStatisticsList ()
2001
2001
statistics .datasets .extend ([statistics_pb2 .DatasetFeatureStatistics ()])
2002
- with self .assertRaisesRegexp (TypeError , '.*should be a Schema proto.*' ):
2002
+ with self .assertRaisesRegex (TypeError , '.*should be a Schema proto.*' ):
2003
2003
_ = validation_api .validate_statistics (statistics , {})
2004
2004
2005
2005
def test_validate_stats_invalid_environment (self ):
@@ -2017,7 +2017,7 @@ def test_validate_stats_invalid_environment(self):
2017
2017
type: BYTES
2018
2018
}
2019
2019
""" , schema_pb2 .Schema ())
2020
- with self .assertRaisesRegexp (
2020
+ with self .assertRaisesRegex (
2021
2021
ValueError , 'Environment.*not found in the schema.*' ):
2022
2022
_ = validation_api .validate_statistics (statistics , schema ,
2023
2023
environment = 'INVALID' )
@@ -2030,7 +2030,7 @@ def test_validate_stats_invalid_statistics_multiple_datasets_no_default_slice(
2030
2030
statistics_pb2 .DatasetFeatureStatistics ()
2031
2031
])
2032
2032
schema = schema_pb2 .Schema ()
2033
- with self .assertRaisesRegexp (
2033
+ with self .assertRaisesRegex (
2034
2034
ValueError , 'Only statistics proto with one dataset or the default.*' ):
2035
2035
_ = validation_api .validate_statistics (statistics , schema )
2036
2036
@@ -2045,7 +2045,7 @@ def test_validate_stats_invalid_previous_statistics_multiple_datasets(self):
2045
2045
statistics_pb2 .DatasetFeatureStatistics ()
2046
2046
])
2047
2047
schema = schema_pb2 .Schema ()
2048
- with self .assertRaisesRegexp (
2048
+ with self .assertRaisesRegex (
2049
2049
ValueError , 'Only statistics proto with one dataset or the default.*' ):
2050
2050
_ = validation_api .validate_statistics (current_stats , schema ,
2051
2051
previous_statistics = previous_stats )
@@ -2061,7 +2061,7 @@ def test_validate_stats_invalid_serving_statistics_multiple_datasets(self):
2061
2061
statistics_pb2 .DatasetFeatureStatistics ()
2062
2062
])
2063
2063
schema = schema_pb2 .Schema ()
2064
- with self .assertRaisesRegexp (
2064
+ with self .assertRaisesRegex (
2065
2065
ValueError , 'Only statistics proto with one dataset or the default.*' ):
2066
2066
_ = validation_api .validate_statistics (current_stats , schema ,
2067
2067
serving_statistics = serving_stats )
@@ -2078,7 +2078,7 @@ def test_validate_stats_invalid_previous_version_stats_multiple_datasets(
2078
2078
statistics_pb2 .DatasetFeatureStatistics ()
2079
2079
])
2080
2080
schema = schema_pb2 .Schema ()
2081
- with self .assertRaisesRegexp (
2081
+ with self .assertRaisesRegex (
2082
2082
ValueError , 'Only statistics proto with one dataset or the default.*' ):
2083
2083
_ = validation_api .validate_statistics_internal (
2084
2084
current_stats ,
@@ -2789,22 +2789,22 @@ def test_validate_instance_invalid_environment(self):
2789
2789
""" , schema_pb2 .Schema ())
2790
2790
options = stats_options .StatsOptions (schema = schema )
2791
2791
2792
- with self .assertRaisesRegexp (
2792
+ with self .assertRaisesRegex (
2793
2793
ValueError , 'Environment.*not found in the schema.*' ):
2794
2794
_ = validation_api .validate_instance (
2795
2795
instance , options , environment = 'INVALID' )
2796
2796
2797
2797
def test_validate_instance_invalid_options (self ):
2798
2798
instance = pa .RecordBatch .from_arrays ([pa .array ([['A' ]])], ['feature' ])
2799
- with self .assertRaisesRegexp (ValueError ,
2799
+ with self .assertRaisesRegex (ValueError ,
2800
2800
'options must be a StatsOptions object.' ):
2801
2801
_ = validation_api .validate_instance (instance , {})
2802
2802
2803
2803
def test_validate_instance_stats_options_without_schema (self ):
2804
2804
instance = pa .RecordBatch .from_arrays ([pa .array ([['A' ]])], ['feature' ])
2805
2805
# This instance of StatsOptions has no schema.
2806
2806
options = stats_options .StatsOptions ()
2807
- with self .assertRaisesRegexp (ValueError , 'options must include a schema.' ):
2807
+ with self .assertRaisesRegex (ValueError , 'options must include a schema.' ):
2808
2808
_ = validation_api .validate_instance (instance , options )
2809
2809
2810
2810
@@ -3201,7 +3201,7 @@ def __eq__(self, other):
3201
3201
def test_identify_anomalous_examples_options_of_wrong_type (self ):
3202
3202
examples = [{'annotated_enum' : np .array (['D' ], dtype = object )}]
3203
3203
options = 1
3204
- with self .assertRaisesRegexp (ValueError , 'options must be a `StatsOptions` '
3204
+ with self .assertRaisesRegex (ValueError , 'options must be a `StatsOptions` '
3205
3205
'object.' ):
3206
3206
with beam .Pipeline () as p :
3207
3207
_ = (
@@ -3211,7 +3211,7 @@ def test_identify_anomalous_examples_options_of_wrong_type(self):
3211
3211
def test_identify_anomalous_examples_options_without_schema (self ):
3212
3212
examples = [{'annotated_enum' : np .array (['D' ], dtype = object )}]
3213
3213
options = stats_options .StatsOptions ()
3214
- with self .assertRaisesRegexp (ValueError , 'options must include a schema' ):
3214
+ with self .assertRaisesRegex (ValueError , 'options must include a schema' ):
3215
3215
with beam .Pipeline () as p :
3216
3216
_ = (
3217
3217
p | beam .Create (examples )
0 commit comments