Skip to content

Commit 180dc3d

Browse files
authored
Replace deprecated unittest aliases (#20337)
1 parent 7f799c9 commit 180dc3d

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

sdk/compute/azure-mgmt-compute/tests/test_mgmt_compute_vm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,14 @@ def test_compute_vm_2(self, resource_group):
363363
result = self.mgmt_client.virtual_machines.begin_perform_maintenance(resource_group.name, VIRTUAL_MACHINE_NAME)
364364
result = result.result()
365365
except ResourceExistsError as e:
366-
self.assertEquals(str(e), "(OperationNotAllowed) Operation 'performMaintenance' is not allowed on VM '%s' since the Subscription of this VM is not eligible." % (VIRTUAL_MACHINE_NAME))
366+
self.assertEqual(str(e), "(OperationNotAllowed) Operation 'performMaintenance' is not allowed on VM '%s' since the Subscription of this VM is not eligible." % (VIRTUAL_MACHINE_NAME))
367367

368368
# VirtualMachine convert to managed disks (TODO: need swagger file)
369369
try:
370370
result = self.mgmt_client.virtual_machines.begin_convert_to_managed_disks(resource_group.name, VIRTUAL_MACHINE_NAME)
371371
result = result.result()
372372
except ResourceExistsError as e:
373-
self.assertEquals(str(e), "(OperationNotAllowed) VM '%s' is already using managed disks." % (VIRTUAL_MACHINE_NAME))
373+
self.assertEqual(str(e), "(OperationNotAllowed) VM '%s' is already using managed disks." % (VIRTUAL_MACHINE_NAME))
374374

375375
# TODO: Message: The Reimage and OSUpgrade Virtual Machine actions require that the virtual machine has Automatic OS Upgrades enabled.
376376
# Reimage a Virtual Machine.[post]
@@ -381,7 +381,7 @@ def test_compute_vm_2(self, resource_group):
381381
result = self.mgmt_client.virtual_machines.begin_reimage(resource_group.name, VIRTUAL_MACHINE_NAME)
382382
result = result.result()
383383
except ResourceExistsError as e:
384-
self.assertEquals(str(e), "(OperationNotAllowed) The Reimage and OSUpgrade Virtual Machine actions require that the virtual machine has Automatic OS Upgrades enabled.")
384+
self.assertEqual(str(e), "(OperationNotAllowed) The Reimage and OSUpgrade Virtual Machine actions require that the virtual machine has Automatic OS Upgrades enabled.")
385385

386386
# Delete virtual machine (TODO: need swagger file)
387387
result = self.mgmt_client.virtual_machines.begin_delete(resource_group.name, VIRTUAL_MACHINE_NAME)

sdk/network/azure-mgmt-network/tests/test_cli_mgmt_network_watcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def create_virtual_hub(self, location, group_name, virtual_wan_name, virtual_hub
149149
try:
150150
result = result.result()
151151
except HttpResponseError as e:
152-
self.assertEquals(str(e), "(InternalServerError) An error occurred.")
152+
self.assertEqual(str(e), "(InternalServerError) An error occurred.")
153153
return result
154154

155155
def create_vm(self, group_name, location, vm_name, network_name, subnet_name, interface_name):

sdk/storage/azure-storage-file-datalake/tests/test_directory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def test_get_access_control_with_match_conditions(self, datalake_storage_account
296296
response = directory_client.get_access_control(etag=resp['etag'], match_condition=MatchConditions.IfNotModified)
297297
# Assert
298298
self.assertIsNotNone(response)
299-
self.assertEquals(response['permissions'], 'rwxrwxrwx')
299+
self.assertEqual(response['permissions'], 'rwxrwxrwx')
300300

301301
@DataLakePreparer()
302302
def test_set_access_control_recursive(self, datalake_storage_account_name, datalake_storage_account_key):
@@ -937,7 +937,7 @@ def test_rename_to_an_existing_directory_in_another_file_system(self, datalake_s
937937
with self.assertRaises(HttpResponseError):
938938
source_directory_client.get_directory_properties()
939939

940-
self.assertEquals(res.url, destination_directory_client.url)
940+
self.assertEqual(res.url, destination_directory_client.url)
941941

942942
@DataLakePreparer()
943943
def test_rename_with_none_existing_destination_condition_and_source_unmodified_condition(self, datalake_storage_account_name, datalake_storage_account_key):
@@ -966,7 +966,7 @@ def test_rename_with_none_existing_destination_condition_and_source_unmodified_c
966966
with self.assertRaises(HttpResponseError):
967967
source_directory_client.get_directory_properties()
968968

969-
self.assertEquals(non_existing_dir_name, res.path_name)
969+
self.assertEqual(non_existing_dir_name, res.path_name)
970970

971971
@DataLakePreparer()
972972
def test_rename_to_an_non_existing_directory_in_another_file_system(self, datalake_storage_account_name, datalake_storage_account_key):
@@ -990,7 +990,7 @@ def test_rename_to_an_non_existing_directory_in_another_file_system(self, datala
990990
with self.assertRaises(HttpResponseError):
991991
source_directory_client.get_directory_properties()
992992

993-
self.assertEquals(non_existing_dir_name, res.path_name)
993+
self.assertEqual(non_existing_dir_name, res.path_name)
994994

995995
@DataLakePreparer()
996996
def test_rename_directory_to_non_empty_directory(self, datalake_storage_account_name, datalake_storage_account_key):

sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ async def test_get_access_control_with_match_conditions_async(self, datalake_sto
315315
match_condition=MatchConditions.IfNotModified)
316316
# Assert
317317
self.assertIsNotNone(response)
318-
self.assertEquals(response['permissions'], 'rwxrwxrwx')
318+
self.assertEqual(response['permissions'], 'rwxrwxrwx')
319319

320320
@DataLakePreparer()
321321
async def test_set_access_control_recursive_async(self, datalake_storage_account_name, datalake_storage_account_key):
@@ -900,7 +900,7 @@ async def test_rename_to_an_existing_directory_in_another_file_system_async(self
900900
with self.assertRaises(HttpResponseError):
901901
await source_directory_client.get_directory_properties()
902902

903-
self.assertEquals(res.url, destination_directory_client.url)
903+
self.assertEqual(res.url, destination_directory_client.url)
904904

905905
@DataLakePreparer()
906906
async def test_rename_with_none_existing_destination_condition_and_source_unmodified_condition_async(self, datalake_storage_account_name, datalake_storage_account_key):
@@ -931,7 +931,7 @@ async def test_rename_with_none_existing_destination_condition_and_source_unmodi
931931
with self.assertRaises(HttpResponseError):
932932
await source_directory_client.get_directory_properties()
933933

934-
self.assertEquals(non_existing_dir_name, res.path_name)
934+
self.assertEqual(non_existing_dir_name, res.path_name)
935935

936936
@DataLakePreparer()
937937
async def test_rename_to_an_non_existing_directory_in_another_file_system_async(self, datalake_storage_account_name, datalake_storage_account_key):
@@ -955,7 +955,7 @@ async def test_rename_to_an_non_existing_directory_in_another_file_system_async(
955955
with self.assertRaises(HttpResponseError):
956956
await source_directory_client.get_directory_properties()
957957

958-
self.assertEquals(non_existing_dir_name, res.path_name)
958+
self.assertEqual(non_existing_dir_name, res.path_name)
959959

960960
@DataLakePreparer()
961961
async def test_rename_directory_to_non_empty_directory_async(self, datalake_storage_account_name, datalake_storage_account_key):

0 commit comments

Comments
 (0)