1- # Copyright 2019-2020 , Optimizely
1+ # Copyright 2019-2021 , Optimizely
22# Licensed under the Apache License, Version 2.0 (the "License");
33# you may not use this file except in compliance with the License.
44# You may obtain a copy of the License at
@@ -32,7 +32,7 @@ def test_init__invalid_logger_fails(self):
3232 class InvalidLogger (object ):
3333 pass
3434
35- with self .assertRaisesRegexp (
35+ with self .assertRaisesRegex (
3636 optimizely_exceptions .InvalidInputException , 'Provided "logger" is in an invalid format.' ,
3737 ):
3838 config_manager .StaticConfigManager (logger = InvalidLogger ())
@@ -43,7 +43,7 @@ def test_init__invalid_error_handler_fails(self):
4343 class InvalidErrorHandler (object ):
4444 pass
4545
46- with self .assertRaisesRegexp (
46+ with self .assertRaisesRegex (
4747 optimizely_exceptions .InvalidInputException , 'Provided "error_handler" is in an invalid format.' ,
4848 ):
4949 config_manager .StaticConfigManager (error_handler = InvalidErrorHandler ())
@@ -54,7 +54,7 @@ def test_init__invalid_notification_center_fails(self):
5454 class InvalidNotificationCenter (object ):
5555 pass
5656
57- with self .assertRaisesRegexp (
57+ with self .assertRaisesRegex (
5858 optimizely_exceptions .InvalidInputException , 'Provided "notification_center" is in an invalid format.' ,
5959 ):
6060 config_manager .StaticConfigManager (notification_center = InvalidNotificationCenter ())
@@ -222,7 +222,7 @@ def test_get_config_blocks(self):
222222class PollingConfigManagerTest (base .BaseTest ):
223223 def test_init__no_sdk_key_no_url__fails (self , _ ):
224224 """ Test that initialization fails if there is no sdk_key or url provided. """
225- self .assertRaisesRegexp (
225+ self .assertRaisesRegex (
226226 optimizely_exceptions .InvalidInputException ,
227227 'Must provide at least one of sdk_key or url.' ,
228228 config_manager .PollingConfigManager ,
@@ -232,7 +232,7 @@ def test_init__no_sdk_key_no_url__fails(self, _):
232232
233233 def test_get_datafile_url__no_sdk_key_no_url_raises (self , _ ):
234234 """ Test that get_datafile_url raises exception if no sdk_key or url is provided. """
235- self .assertRaisesRegexp (
235+ self .assertRaisesRegex (
236236 optimizely_exceptions .InvalidInputException ,
237237 'Must provide at least one of sdk_key or url.' ,
238238 config_manager .PollingConfigManager .get_datafile_url ,
@@ -244,7 +244,7 @@ def test_get_datafile_url__no_sdk_key_no_url_raises(self, _):
244244 def test_get_datafile_url__invalid_url_template_raises (self , _ ):
245245 """ Test that get_datafile_url raises if url_template is invalid. """
246246 # No url_template provided
247- self .assertRaisesRegexp (
247+ self .assertRaisesRegex (
248248 optimizely_exceptions .InvalidInputException ,
249249 'Invalid url_template None provided' ,
250250 config_manager .PollingConfigManager .get_datafile_url ,
@@ -255,7 +255,7 @@ def test_get_datafile_url__invalid_url_template_raises(self, _):
255255
256256 # Incorrect url_template provided
257257 test_url_template = 'invalid_url_template_without_sdk_key_field_{key}'
258- self .assertRaisesRegexp (
258+ self .assertRaisesRegex (
259259 optimizely_exceptions .InvalidInputException ,
260260 'Invalid url_template {} provided' .format (test_url_template ),
261261 config_manager .PollingConfigManager .get_datafile_url ,
@@ -298,7 +298,7 @@ def test_set_update_interval(self, _):
298298 project_config_manager = config_manager .PollingConfigManager (sdk_key = 'some_key' )
299299
300300 # Assert that if invalid update_interval is set, then exception is raised.
301- with self .assertRaisesRegexp (
301+ with self .assertRaisesRegex (
302302 optimizely_exceptions .InvalidInputException , 'Invalid update_interval "invalid interval" provided.' ,
303303 ):
304304 project_config_manager .set_update_interval ('invalid interval' )
@@ -325,7 +325,7 @@ def test_set_blocking_timeout(self, _):
325325 project_config_manager = config_manager .PollingConfigManager (sdk_key = 'some_key' )
326326
327327 # Assert that if invalid blocking_timeout is set, then exception is raised.
328- with self .assertRaisesRegexp (
328+ with self .assertRaisesRegex (
329329 optimizely_exceptions .InvalidInputException , 'Invalid blocking timeout "invalid timeout" provided.' ,
330330 ):
331331 project_config_manager .set_blocking_timeout ('invalid timeout' )
@@ -484,7 +484,7 @@ def test_is_running(self, _):
484484class AuthDatafilePollingConfigManagerTest (base .BaseTest ):
485485 def test_init__datafile_access_token_none__fails (self , _ ):
486486 """ Test that initialization fails if datafile_access_token is None. """
487- self .assertRaisesRegexp (
487+ self .assertRaisesRegex (
488488 optimizely_exceptions .InvalidInputException ,
489489 'datafile_access_token cannot be empty or None.' ,
490490 config_manager .AuthDatafilePollingConfigManager ,
0 commit comments