@@ -43,23 +43,23 @@ def test_invalid_args(self):
4343
4444 def test_one_device_strategy_cpu (self ):
4545 ds = distribute_utils .get_distribution_strategy ('one_device' , num_gpus = 0 )
46- self .assertEquals (ds .num_replicas_in_sync , 1 )
47- self .assertEquals (len (ds .extended .worker_devices ), 1 )
46+ self .assertEqual (ds .num_replicas_in_sync , 1 )
47+ self .assertEqual (len (ds .extended .worker_devices ), 1 )
4848 self .assertIn ('CPU' , ds .extended .worker_devices [0 ])
4949
5050 def test_one_device_strategy_gpu (self ):
5151 ds = distribute_utils .get_distribution_strategy ('one_device' , num_gpus = 1 )
52- self .assertEquals (ds .num_replicas_in_sync , 1 )
53- self .assertEquals (len (ds .extended .worker_devices ), 1 )
52+ self .assertEqual (ds .num_replicas_in_sync , 1 )
53+ self .assertEqual (len (ds .extended .worker_devices ), 1 )
5454 self .assertIn ('GPU' , ds .extended .worker_devices [0 ])
5555
5656 def test_mirrored_strategy (self ):
5757 # CPU only.
5858 _ = distribute_utils .get_distribution_strategy (num_gpus = 0 )
5959 # 5 GPUs.
6060 ds = distribute_utils .get_distribution_strategy (num_gpus = 5 )
61- self .assertEquals (ds .num_replicas_in_sync , 5 )
62- self .assertEquals (len (ds .extended .worker_devices ), 5 )
61+ self .assertEqual (ds .num_replicas_in_sync , 5 )
62+ self .assertEqual (len (ds .extended .worker_devices ), 5 )
6363 for device in ds .extended .worker_devices :
6464 self .assertIn ('GPU' , device )
6565
@@ -105,12 +105,13 @@ def test_tpu_strategy(self):
105105 ds , tf .distribute .TPUStrategy )
106106
107107 def test_invalid_strategy (self ):
108- with self .assertRaisesRegexp (
109- ValueError ,
110- 'distribution_strategy must be a string but got: False. If' ):
108+ with self .assertRaisesRegex (
109+ ValueError , 'distribution_strategy must be a string but got: False. If'
110+ ):
111111 distribute_utils .get_distribution_strategy (False )
112- with self .assertRaisesRegexp (
113- ValueError , 'distribution_strategy must be a string but got: 1' ):
112+ with self .assertRaisesRegex (
113+ ValueError , 'distribution_strategy must be a string but got: 1'
114+ ):
114115 distribute_utils .get_distribution_strategy (1 )
115116
116117 def test_get_strategy_scope (self ):
0 commit comments