Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Core} aaz: Fix invalid escape in tests #29680

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/azure-cli-core/azure/cli/core/tests/test_aaz_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
ctx = None

# test set
with self.assertRaisesRegex(InvalidArgumentValueError, "Empty key in --set"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Empty key in --set"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -379,7 +379,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "Couldn't find '\[1\]' in ''. Available options: \['d', 'd2', 'i', 'l', 'l2', 's'\]"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Couldn't find '\[1\]' in ''. Available options: \['d', 'd2', 'i', 'l', 'l2', 's'\]"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -389,7 +389,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "Couldn't find 'props' in ''. Available options: \['d', 'd2', 'i', 'l', 'l2', 's'\]"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Couldn't find 'props' in ''. Available options: \['d', 'd2', 'i', 'l', 'l2', 's'\]"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -399,7 +399,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "Couldn't find 'o' in 'l\[0\]'. Available options: \['p', 's'\]"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Couldn't find 'o' in 'l\[0\]'. Available options: \['p', 's'\]"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -409,7 +409,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "non-unique key 'p' found"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"non-unique key 'p' found"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -420,7 +420,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "item with value 'x' doesn't exist for key 'p' on l"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"item with value 'x' doesn't exist for key 'p' on l"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -431,7 +431,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "index 10 doesn't exist"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"index 10 doesn't exist"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -441,7 +441,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "Couldn't find 't' in 'l\[1\]'. Available options: \['p', 's'\]"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Couldn't find 't' in 'l\[1\]'. Available options: \['p', 's'\]"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -451,7 +451,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "`--set property1.property2=<value>`"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"`--set property1.property2=<value>`"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -461,7 +461,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "Expect <class 'str'>, got 3 \(<class 'int'>\)"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Expect <class 'str'>, got 3 \(<class 'int'>\)"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -471,7 +471,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "index 8 doesn't exist on l"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"index 8 doesn't exist on l"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -481,7 +481,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "Couldn't find '\[10\]' in 'd'. Available options: \['a', 'b', 'c'\]"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Couldn't find '\[10\]' in 'd'. Available options: \['a', 'b', 'c'\]"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -492,7 +492,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
)

# test add
with self.assertRaisesRegex(InvalidArgumentValueError, "Expect <class 'int'>, got a \(<class 'str'>\)"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"Expect <class 'int'>, got a \(<class 'str'>\)"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -504,7 +504,7 @@ def test_aaz_generic_update_operation_with_error_response(self):

# test remove

with self.assertRaisesRegex(InvalidArgumentValueError, "index 9 doesn't exist"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"index 9 doesn't exist"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -514,7 +514,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "`--remove property.list <indexToRemove>` OR `--remove propertyToRemove`"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"`--remove property.list <indexToRemove>` OR `--remove propertyToRemove`"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -524,7 +524,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "index 2 doesn't exist on l"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"index 2 doesn't exist on l"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand All @@ -535,7 +535,7 @@ def test_aaz_generic_update_operation_with_error_response(self):
}
)

with self.assertRaisesRegex(InvalidArgumentValueError, "index 1 doesn't exist on s"):
with self.assertRaisesRegex(InvalidArgumentValueError, r"index 1 doesn't exist on s"):
AAZGenericInstanceUpdateOperation(ctx)._update_instance_by_generic(
instance,
{
Expand Down