Repository: getmoto/moto

Issue:
invalid escape sequence occurrences in string literals
Currently we have bunch of places where invalid escape sequences are being used in string literals (mostly in regex patterns). It throws deprecation warning in the tests

eg:

```
 tests/test_efs/test_file_system.py:13
  /home/runner/work/moto/moto/tests/test_efs/test_file_system.py:13: DeprecationWarning: invalid escape sequence \/
    ARN_PATT = "^arn:(?P<Partition>[^:\n]*):(?P<Service>[^:\n]*):(?P<Region>[^:\n]*):(?P<AccountID>[^:\n]*):(?P<Ignore>(?P<ResourceType>[^:\/\n]*)[:\/])?(?P<Resource>.*)$"
```

<!-- Edit the body of your new issue then click the ✓ "Create Issue" button in the top right of the editor. The first line will be the issue title. Assignees and Labels follow after a blank line. Leave an empty line before beginning the body of the issue. -->


Discussion:

Resolving patch:
diff --git a/moto/athena/urls.py b/moto/athena/urls.py
--- a/moto/athena/urls.py
+++ b/moto/athena/urls.py
@@ -1,6 +1,6 @@
 from __future__ import unicode_literals
 from .responses import AthenaResponse
 
-url_bases = ["https?://athena\.(.+)\.amazonaws\.com"]
+url_bases = [r"https?://athena\.(.+)\.amazonaws\.com"]
 
 url_paths = {"{0}/$": AthenaResponse.dispatch}


Test patch:
diff --git a/tests/test_ec2/test_tags.py b/tests/test_ec2/test_tags.py
--- a/tests/test_ec2/test_tags.py
+++ b/tests/test_ec2/test_tags.py
@@ -561,9 +561,9 @@ def filter_by_value(query, expected):
     filter_by_value("some*value", [instance_a.id, instance_b.id, image.id])
     filter_by_value("*some*value", [instance_a.id, instance_b.id, image.id])
     filter_by_value("*some*value*", [instance_a.id, instance_b.id, image.id])
-    filter_by_value("*value\*", [instance_c.id])
-    filter_by_value("*value\*\*", [instance_d.id])
-    filter_by_value("*value\*\?", [instance_e.id])
+    filter_by_value(r"*value\*", [instance_c.id])
+    filter_by_value(r"*value\*\*", [instance_d.id])
+    filter_by_value(r"*value\*\?", [instance_e.id])
 
 
 # Has boto3 equivalent
diff --git a/tests/test_efs/test_file_system.py b/tests/test_efs/test_file_system.py
--- a/tests/test_efs/test_file_system.py
+++ b/tests/test_efs/test_file_system.py
@@ -10,8 +10,8 @@
 from moto import mock_efs
 from tests.test_efs.junk_drawer import has_status_code
 
-ARN_PATT = "^arn:(?P<Partition>[^:\n]*):(?P<Service>[^:\n]*):(?P<Region>[^:\n]*):(?P<AccountID>[^:\n]*):(?P<Ignore>(?P<ResourceType>[^:\/\n]*)[:\/])?(?P<Resource>.*)$"
-STRICT_ARN_PATT = "^arn:aws:[a-z]+:[a-z]{2}-[a-z]+-[0-9]:[0-9]+:[a-z-]+\/[a-z0-9-]+$"
+ARN_PATT = r"^arn:(?P<Partition>[^:\n]*):(?P<Service>[^:\n]*):(?P<Region>[^:\n]*):(?P<AccountID>[^:\n]*):(?P<Ignore>(?P<ResourceType>[^:\/\n]*)[:\/])?(?P<Resource>.*)$"
+STRICT_ARN_PATT = r"^arn:aws:[a-z]+:[a-z]{2}-[a-z]+-[0-9]:[0-9]+:[a-z-]+\/[a-z0-9-]+$"
 
 SAMPLE_1_PARAMS = {
     "CreationToken": "myFileSystem1",
diff --git a/tests/test_iam/test_iam.py b/tests/test_iam/test_iam.py
--- a/tests/test_iam/test_iam.py
+++ b/tests/test_iam/test_iam.py
@@ -795,7 +795,7 @@ def test_set_default_policy_version():
         VersionId="wrong_version_id",
     ).should.throw(
         ClientError,
-        "Value 'wrong_version_id' at 'versionId' failed to satisfy constraint: Member must satisfy regular expression pattern: v[1-9][0-9]*(\.[A-Za-z0-9-]*)?",
+        r"Value 'wrong_version_id' at 'versionId' failed to satisfy constraint: Member must satisfy regular expression pattern: v[1-9][0-9]*(\.[A-Za-z0-9-]*)?",
     )
 
     # Set default version for non-existing version
diff --git a/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py b/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py
--- a/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py
+++ b/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py
@@ -25,7 +25,7 @@ def test_get_hls_streaming_session_url():
         endpoint_url=data_endpoint,
     )
     res = client.get_hls_streaming_session_url(StreamName=stream_name,)
-    reg_exp = "^{}/hls/v1/getHLSMasterPlaylist.m3u8\?SessionToken\=.+$".format(
+    reg_exp = r"^{}/hls/v1/getHLSMasterPlaylist.m3u8\?SessionToken\=.+$".format(
         data_endpoint
     )
     res.should.have.key("HLSStreamingSessionURL").which.should.match(reg_exp)
@@ -49,7 +49,9 @@ def test_get_dash_streaming_session_url():
         endpoint_url=data_endpoint,
     )
     res = client.get_dash_streaming_session_url(StreamName=stream_name,)
-    reg_exp = "^{}/dash/v1/getDASHManifest.mpd\?SessionToken\=.+$".format(data_endpoint)
+    reg_exp = r"^{}/dash/v1/getDASHManifest.mpd\?SessionToken\=.+$".format(
+        data_endpoint
+    )
     res.should.have.key("DASHStreamingSessionURL").which.should.match(reg_exp)
 
 
diff --git a/tests/test_redshift/test_redshift.py b/tests/test_redshift/test_redshift.py
--- a/tests/test_redshift/test_redshift.py
+++ b/tests/test_redshift/test_redshift.py
@@ -938,7 +938,7 @@ def test_create_invalid_cluster_subnet_group_boto3():
         )
     err = ex.value.response["Error"]
     err["Code"].should.equal("InvalidSubnet")
-    err["Message"].should.match("Subnet \[[a-z0-9-']+\] not found.")
+    err["Message"].should.match(r"Subnet \[[a-z0-9-']+\] not found.")
 
 
 # Has boto3 equivalent