internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: getmoto/moto

Issue:
DeprecationWarning: invalid escape sequence
w/ latest moto I'm getting the following warnings while importing moto:

```
 moto/ec2/utils.py:459: DeprecationWarning: invalid escape sequence \*
    tmp_filter = tmp_filter.replace('\*', '[*]')
moto/ec2/utils.py:489: DeprecationWarning: invalid escape sequence \Z
    '[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}\Z', re.I)
moto/ec2/utils.py:508: DeprecationWarning: invalid escape sequence \.
    cidr_pattern = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$'
```

amongst many others.   I think what's missing is just a `r` for raw string around them.  The static `re.compile`s should probably be global as well.

I'd add deprecation warnings as a linting/unittest failure as well.


Discussion:

Resolving patch:
diff --git a/moto/ec2/utils.py b/moto/ec2/utils.py
--- a/moto/ec2/utils.py
+++ b/moto/ec2/utils.py
@@ -50,7 +50,7 @@
 
 def random_resource_id(size=8):
     chars = list(range(10)) + ['a', 'b', 'c', 'd', 'e', 'f']
-    resource_id = ''.join(six.text_type(random.choice(chars)) for x in range(size))
+    resource_id = ''.join(six.text_type(random.choice(chars)) for _ in range(size))
     return resource_id
 
 
@@ -460,8 +460,8 @@ def generic_filter(filters, objects):
 
 
 def simple_aws_filter_to_re(filter_string):
-    tmp_filter = filter_string.replace('\?', '[?]')
-    tmp_filter = tmp_filter.replace('\*', '[*]')
+    tmp_filter = filter_string.replace(r'\?', '[?]')
+    tmp_filter = tmp_filter.replace(r'\*', '[*]')
     tmp_filter = fnmatch.translate(tmp_filter)
     return tmp_filter
 
@@ -491,7 +491,7 @@ def get_prefix(resource_id):
                 'network-interface-attachment']
     if resource_id_prefix not in EC2_RESOURCE_TO_PREFIX.values():
         uuid4hex = re.compile(
-            '[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}\Z', re.I)
+            r'[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}\Z', re.I)
         if uuid4hex.match(resource_id) is not None:
             resource_id_prefix = EC2_RESOURCE_TO_PREFIX['reserved-instance']
         else:
@@ -510,7 +510,7 @@ def is_valid_resource_id(resource_id):
 
 
 def is_valid_cidr(cird):
-    cidr_pattern = '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$'
+    cidr_pattern = r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$'
     cidr_pattern_re = re.compile(cidr_pattern)
     return cidr_pattern_re.match(cird) is not None
 


Test patch:
Repository: getmoto/moto

Issue:
IoT Delete Thing should remove the attachment to the principals
# Bug
When deleting a thing in IoT that has some principals attached to it, those attachment go away automatically. This is not the case in moto, so if you try to delete the certificate you will get an error.

# What should happen
In the `delete_thing` function of the backend, you should iterate over the structure `self.principal_things` to remove all that contain the `thing_name`.

# Code to reproduce
```python
client = boto3.client("iot")
client.create_thing(thingName="mything")
certificate = client.create_keys_and_certificate(setAsActive=True)
client.attach_thing_principal(thingName="mything", principal=certificate["certificateArn"])

client.delete_thing(thingName="mything")
client.update_certificate(certificateId=certificate["certificateId"], newStatus="INACTIVE")
client.delete_certificate(certificateId=certificate["certificateId"])
```

EDIT 1: I am working on the fix, I will submit a PR in the next hour



Discussion:

Resolving patch:
diff --git a/moto/iot/models.py b/moto/iot/models.py
--- a/moto/iot/models.py
+++ b/moto/iot/models.py
@@ -331,6 +331,12 @@ def delete_thing(self, thing_name, expected_version):
 
         # can raise ResourceNotFoundError
         thing = self.describe_thing(thing_name)
+
+        # detach all principals
+        for k in list(self.principal_things.keys()):
+            if k[1] == thing_name:
+                del self.principal_things[k]
+
         del self.things[thing.arn]
 
     def delete_thing_type(self, thing_type_name):


Test patch:
diff --git a/tests/test_iot/test_iot.py b/tests/test_iot/test_iot.py
--- a/tests/test_iot/test_iot.py
+++ b/tests/test_iot/test_iot.py
@@ -519,6 +519,25 @@ def test_principal_thing():
     res.should.have.key('principals').which.should.have.length_of(0)
 
 
+@mock_iot
+def test_delete_principal_thing():
+    client = boto3.client('iot', region_name='ap-northeast-1')
+    thing_name = 'my-thing'
+    thing = client.create_thing(thingName=thing_name)
+    cert = client.create_keys_and_certificate(setAsActive=True)
+    cert_arn = cert['certificateArn']
+    cert_id = cert['certificateId']
+
+    client.attach_thing_principal(thingName=thing_name, principal=cert_arn)
+
+    client.delete_thing(thingName=thing_name)
+    res = client.list_principal_things(principal=cert_arn)
+    res.should.have.key('things').which.should.have.length_of(0)
+
+    client.update_certificate(certificateId=cert_id, newStatus="INACTIVE")
+    client.delete_certificate(certificateId=cert_id)
+
+
 @mock_iot
 def test_thing_groups():
     client = boto3.client('iot', region_name='ap-northeast-1')
Repository: getmoto/moto

Issue:
Missing IAM delete_group endpoint 
Hi,

I needed the delete_group feature for a project I'm working on, so I've implemented it in a branch locally, which I can add to a PR. I don't seem to be able to 

Thanks


Discussion:
Raised PR #2164

Resolving patch:
diff --git a/moto/iam/models.py b/moto/iam/models.py
--- a/moto/iam/models.py
+++ b/moto/iam/models.py
@@ -1221,6 +1221,14 @@ def get_group_policy(self, group_name, policy_name):
         group = self.get_group(group_name)
         return group.get_policy(policy_name)
 
+    def delete_group(self, group_name):
+        try:
+            del self.groups[group_name]
+        except KeyError:
+            raise IAMNotFoundException(
+                "The group with name {0} cannot be found.".format(group_name)
+            )
+
     def create_user(self, user_name, path="/"):
         if user_name in self.users:
             raise IAMConflictException(
diff --git a/moto/iam/responses.py b/moto/iam/responses.py
--- a/moto/iam/responses.py
+++ b/moto/iam/responses.py
@@ -428,6 +428,12 @@ def get_group_policy(self):
         template = self.response_template(GET_GROUP_POLICY_TEMPLATE)
         return template.render(name="GetGroupPolicyResponse", **policy_result)
 
+    def delete_group(self):
+        group_name = self._get_param("GroupName")
+        iam_backend.delete_group(group_name)
+        template = self.response_template(GENERIC_EMPTY_TEMPLATE)
+        return template.render(name="DeleteGroup")
+
     def create_user(self):
         user_name = self._get_param("UserName")
         path = self._get_param("Path")


Test patch:
diff --git a/tests/test_iam/test_iam_groups.py b/tests/test_iam/test_iam_groups.py
--- a/tests/test_iam/test_iam_groups.py
+++ b/tests/test_iam/test_iam_groups.py
@@ -8,6 +8,7 @@
 
 from nose.tools import assert_raises
 from boto.exception import BotoServerError
+from botocore.exceptions import ClientError
 from moto import mock_iam, mock_iam_deprecated
 
 MOCK_POLICY = """
@@ -182,3 +183,25 @@ def test_list_group_policies():
     conn.list_group_policies(GroupName="my-group")["PolicyNames"].should.equal(
         ["my-policy"]
     )
+
+
+@mock_iam
+def test_delete_group():
+    conn = boto3.client("iam", region_name="us-east-1")
+    conn.create_group(GroupName="my-group")
+    groups = conn.list_groups()
+    assert groups["Groups"][0]["GroupName"] == "my-group"
+    assert len(groups["Groups"]) == 1
+    conn.delete_group(GroupName="my-group")
+    conn.list_groups()["Groups"].should.be.empty
+
+
+@mock_iam
+def test_delete_unknown_group():
+    conn = boto3.client("iam", region_name="us-east-1")
+    with assert_raises(ClientError) as err:
+        conn.delete_group(GroupName="unknown-group")
+    err.exception.response["Error"]["Code"].should.equal("NoSuchEntity")
+    err.exception.response["Error"]["Message"].should.equal(
+        "The group with name unknown-group cannot be found."
+    )
Repository: getmoto/moto

Issue:
Version Conflict in latest docker image (1.3.14)
My e2e tests started failing today, reverting to 1.3.5 fixed the issue.

docker-compose section
```yml
cognito:
  image: motoserver/moto
  ports:
    - 5000
  command: -p 5000 cognito-idp
```

```
cognito_1      | Traceback (most recent call last):
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 583, in _build_master
cognito_1      |     ws.require(__requires__)
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 900, in require
cognito_1      |     needed = self.resolve(parse_requirements(requirements))
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 791, in resolve
cognito_1      |     raise VersionConflict(dist, req).with_context(dependent_req)
cognito_1      | pkg_resources.ContextualVersionConflict: (python-dateutil 2.8.1 (/usr/lib/python3.6/site-packages), Requirement.parse('python-dateutil<2.8.1,>=2.1; python_version >= "2.7"'), {'botocore'})
cognito_1      | 
cognito_1      | During handling of the above exception, another exception occurred:
cognito_1      | 
cognito_1      | Traceback (most recent call last):
cognito_1      |   File "/usr/bin/moto_server", line 6, in <module>
cognito_1      |     from pkg_resources import load_entry_point
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3251, in <module>
cognito_1      |     @_call_aside
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
cognito_1      |     f(*args, **kwargs)
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
cognito_1      |     working_set = WorkingSet._build_master()
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 585, in _build_master
cognito_1      |     return cls._build_from_requirements(__requires__)
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
cognito_1      |     dists = ws.resolve(reqs, Environment())
cognito_1      |   File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 791, in resolve
cognito_1      |     raise VersionConflict(dist, req).with_context(dependent_req)
cognito_1      | pkg_resources.ContextualVersionConflict: (python-dateutil 2.8.1 (/usr/lib/python3.6/site-packages), Requirement.parse('python-dateutil<2.8.1,>=2.1; python_version >= "2.7"'), {'botocore'})
```


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -39,7 +39,7 @@ def get_version():
     "werkzeug",
     "PyYAML>=5.1",
     "pytz",
-    "python-dateutil<3.0.0,>=2.1",
+    "python-dateutil<2.8.1,>=2.1",
     "python-jose<4.0.0",
     "mock",
     "docker>=2.5.1",


Test patch:
Repository: getmoto/moto

Issue:
Bad response model for EC2 DescribeVpcClassicLinkDnsSupport
The response to https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcClassicLinkDnsSupport.html returns an empty string on the wire instead of `true` or `false`:

```
<DescribeVpcClassicLinkDnsSupportResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"><requestId>7a62c442-3484-4f42-9342-6942EXAMPLE</requestId><vpcs><item><vpcId>vpc-aa9e54e7</vpcId><classicLinkDnsSupported></classicLinkDnsSupported></item></vpcs></DescribeVpcClassicLinkDnsSupportResponse>
```


Discussion:

Resolving patch:
diff --git a/moto/ec2/models.py b/moto/ec2/models.py
--- a/moto/ec2/models.py
+++ b/moto/ec2/models.py
@@ -2449,6 +2449,7 @@ def __init__(
         self.is_default = "true" if is_default else "false"
         self.enable_dns_support = "true"
         self.classic_link_enabled = "false"
+        self.classic_link_dns_supported = "false"
         # This attribute is set to 'true' only for default VPCs
         # or VPCs created using the wizard of the VPC console
         self.enable_dns_hostnames = "true" if is_default else "false"


Test patch:
Repository: getmoto/moto

Issue:
[bug] Route53.list_resource_record_sets not returning `IsTruncated`
`boto3` documentation specifies that `list_resource_record_sets` should return:
```python
'IsTruncated': True|False,
```
to indicate if results were truncated.

AWS API always returns this field, whether records are truncated or not. We rely on this field to know if we need to fetch more results, and using `@mock_route53` around this code fails due to missing field.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.list_resource_record_sets


Discussion:

Resolving patch:
diff --git a/moto/route53/responses.py b/moto/route53/responses.py
--- a/moto/route53/responses.py
+++ b/moto/route53/responses.py
@@ -271,6 +271,7 @@ def list_or_change_tags_for_resource_request(self, request, full_url, headers):
       {{ record_set.to_xml() }}
    {% endfor %}
    </ResourceRecordSets>
+   <IsTruncated>false</IsTruncated>
 </ListResourceRecordSetsResponse>"""
 
 CHANGE_RRSET_RESPONSE = """<ChangeResourceRecordSetsResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/">


Test patch:
diff --git a/tests/test_route53/test_route53.py b/tests/test_route53/test_route53.py
--- a/tests/test_route53/test_route53.py
+++ b/tests/test_route53/test_route53.py
@@ -862,6 +862,8 @@ def create_resource_record_set(rec_type, rec_name):
         StartRecordName=all_records[start_with][1],
     )
 
+    response["IsTruncated"].should.equal(False)
+
     returned_records = [
         (record["Type"], record["Name"]) for record in response["ResourceRecordSets"]
     ]
Repository: getmoto/moto

Issue:
Cognito User Pool response missing ARN
Cognito User Pools include an 'Arn' parameter with the full Cognito ARN for the user pool, but moto does not include this in the response when working with user pools.

For instance:
```
$ aws cognito-idp create-user-pool --pool-name jrbeilke-test
{
    "UserPool": {
        "Id": "us-east-1_FBJxNNqV0",
        "Name": "jrbeilke-test",
....
        "MfaConfiguration": "OFF",
        "EstimatedNumberOfUsers": 0,
        "EmailConfiguration": {
            "EmailSendingAccount": "COGNITO_DEFAULT"
        },
        "AdminCreateUserConfig": {
            "AllowAdminCreateUserOnly": false,
            "UnusedAccountValidityDays": 7
        },
        "Arn": "arn:aws:cognito-idp:us-east-1:139818921685:userpool/us-east-1_FBJxNNqV0"
    }
}
```




Discussion:

Resolving patch:
diff --git a/moto/cognitoidp/models.py b/moto/cognitoidp/models.py
--- a/moto/cognitoidp/models.py
+++ b/moto/cognitoidp/models.py
@@ -14,6 +14,7 @@
 
 from moto.compat import OrderedDict
 from moto.core import BaseBackend, BaseModel
+from moto.core import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
 from .exceptions import (
     GroupExistsException,
     NotAuthorizedError,
@@ -69,6 +70,9 @@ class CognitoIdpUserPool(BaseModel):
     def __init__(self, region, name, extended_config):
         self.region = region
         self.id = "{}_{}".format(self.region, str(uuid.uuid4().hex))
+        self.arn = "arn:aws:cognito-idp:{}:{}:userpool/{}".format(
+            self.region, DEFAULT_ACCOUNT_ID, self.id
+        )
         self.name = name
         self.status = None
         self.extended_config = extended_config or {}
@@ -91,6 +95,7 @@ def __init__(self, region, name, extended_config):
     def _base_json(self):
         return {
             "Id": self.id,
+            "Arn": self.arn,
             "Name": self.name,
             "Status": self.status,
             "CreationDate": time.mktime(self.creation_date.timetuple()),


Test patch:
diff --git a/tests/test_cognitoidp/test_cognitoidp.py b/tests/test_cognitoidp/test_cognitoidp.py
--- a/tests/test_cognitoidp/test_cognitoidp.py
+++ b/tests/test_cognitoidp/test_cognitoidp.py
@@ -27,6 +27,11 @@ def test_create_user_pool():
 
     result["UserPool"]["Id"].should_not.be.none
     result["UserPool"]["Id"].should.match(r"[\w-]+_[0-9a-zA-Z]+")
+    result["UserPool"]["Arn"].should.equal(
+        "arn:aws:cognito-idp:us-west-2:{}:userpool/{}".format(
+            ACCOUNT_ID, result["UserPool"]["Id"]
+        )
+    )
     result["UserPool"]["Name"].should.equal(name)
     result["UserPool"]["LambdaConfig"]["PreSignUp"].should.equal(value)
Repository: getmoto/moto

Issue:
EMR list_step responses don't contain start date in output
There is a bug in the LIST_STEP_TEMPLATE and other EMR templates around the start date for steps: the conditional looks at `ready_datetime` but then outputs `start_datetime`.

This from https://github.com/spulec/moto/blob/896f040fca975865c1d441d90016446c72db3ed4/moto/emr/responses.py#L794-L796

```
            {% if step.ready_datetime is not none %}
            <StartDateTime>{{ step.start_datetime.isoformat() }}</StartDateTime>
            {% endif %}
```

Nothing in the code looks at `step.ready_datetime` that I could see (use create, start, and end), so I'm guessing the conditional is wrong. This exists in a few other templates too.


Discussion:
This looks like it has been fixed.
Not sure that it is. The template at least still has the same block in master

https://github.com/spulec/moto/blob/ec3f6bbc6ce1b477efb1ec76ca333f7271ac0c88/moto/emr/responses.py#L838-L840

Resolving patch:
diff --git a/moto/emr/models.py b/moto/emr/models.py
--- a/moto/emr/models.py
+++ b/moto/emr/models.py
@@ -86,6 +86,9 @@ def __init__(
         self.start_datetime = None
         self.state = state
 
+    def start(self):
+        self.start_datetime = datetime.now(pytz.utc)
+
 
 class FakeCluster(BaseModel):
     def __init__(
@@ -204,6 +207,8 @@ def __init__(
 
         self.start_cluster()
         self.run_bootstrap_actions()
+        if self.steps:
+            self.steps[0].start()
 
     @property
     def instance_groups(self):
diff --git a/moto/emr/responses.py b/moto/emr/responses.py
--- a/moto/emr/responses.py
+++ b/moto/emr/responses.py
@@ -835,7 +835,7 @@ def terminate_job_flows(self):
             {% if step.end_datetime is not none %}
             <EndDateTime>{{ step.end_datetime.isoformat() }}</EndDateTime>
             {% endif %}
-            {% if step.ready_datetime is not none %}
+            {% if step.start_datetime is not none %}
             <StartDateTime>{{ step.start_datetime.isoformat() }}</StartDateTime>
             {% endif %}
           </Timeline>


Test patch:
diff --git a/tests/test_emr/test_emr_boto3.py b/tests/test_emr/test_emr_boto3.py
--- a/tests/test_emr/test_emr_boto3.py
+++ b/tests/test_emr/test_emr_boto3.py
@@ -752,7 +752,9 @@ def test_steps():
         # StateChangeReason
         x["Status"]["Timeline"]["CreationDateTime"].should.be.a("datetime.datetime")
         # x['Status']['Timeline']['EndDateTime'].should.be.a('datetime.datetime')
-        # x['Status']['Timeline']['StartDateTime'].should.be.a('datetime.datetime')
+        # Only the first step will have started - we don't know anything about when it finishes, so the second step never starts
+        if x["Name"] == "My wordcount example":
+            x["Status"]["Timeline"]["StartDateTime"].should.be.a("datetime.datetime")
 
         x = client.describe_step(ClusterId=cluster_id, StepId=x["Id"])["Step"]
         x["ActionOnFailure"].should.equal("TERMINATE_CLUSTER")
Repository: getmoto/moto

Issue:
stepfunction stop_execution should result in an ABORTED status
https://github.com/spulec/moto/blob/95e95cc97d122d1f5efa38032147e1a17dce1564/moto/stepfunctions/models.py#L49

Confirmed with actual API calls
<img width="1462" alt="Screen Shot 2020-03-27 at 3 08 54 PM" src="https://user-images.githubusercontent.com/44036468/77796760-e1183f00-703d-11ea-8021-5ce235bb13c1.png">
<img width="1673" alt="Screen_Shot_2020-03-27_at_3_14_44_PM" src="https://user-images.githubusercontent.com/44036468/77796766-e2e20280-703d-11ea-962a-f7f1b696df7d.png">



Discussion:

Resolving patch:
diff --git a/moto/stepfunctions/models.py b/moto/stepfunctions/models.py
--- a/moto/stepfunctions/models.py
+++ b/moto/stepfunctions/models.py
@@ -46,7 +46,7 @@ def __init__(
         self.stop_date = None
 
     def stop(self):
-        self.status = "SUCCEEDED"
+        self.status = "ABORTED"
         self.stop_date = iso_8601_datetime_without_milliseconds(datetime.now())
 
 


Test patch:
diff --git a/tests/test_stepfunctions/test_stepfunctions.py b/tests/test_stepfunctions/test_stepfunctions.py
--- a/tests/test_stepfunctions/test_stepfunctions.py
+++ b/tests/test_stepfunctions/test_stepfunctions.py
@@ -516,7 +516,7 @@ def test_state_machine_describe_execution_after_stoppage():
     description = client.describe_execution(executionArn=execution["executionArn"])
     #
     description["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
-    description["status"].should.equal("SUCCEEDED")
+    description["status"].should.equal("ABORTED")
     description["stopDate"].should.be.a(datetime)
Repository: getmoto/moto

Issue:
Cognito Identity identity_id format should be in format `REGION:GUID`
Hi

Running tests using moto revealed issue with the _identity id_ gotten from `cognitoidentity`. In reality aws _identity_ids_ should be `REGION:GUID`.[0] However moto creates an _identity id_ in format `"{0}:{1}".format(region, get_random_hex(length=19))`. [1] This causes issues when being strict with what the format is expected to be.

[0] https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cognito-identity.html#CognitoIdentity.Client.get_id
[1] https://github.com/spulec/moto/blob/master/moto/cognitoidentity/utils.py


Discussion:

Resolving patch:
diff --git a/moto/cognitoidentity/utils.py b/moto/cognitoidentity/utils.py
--- a/moto/cognitoidentity/utils.py
+++ b/moto/cognitoidentity/utils.py
@@ -1,5 +1,5 @@
-from moto.core.utils import get_random_hex
+from uuid import uuid4
 
 
 def get_random_identity_id(region):
-    return "{0}:{1}".format(region, get_random_hex(length=19))
+    return "{0}:{1}".format(region, uuid4())


Test patch:
diff --git a/tests/test_cognitoidentity/test_cognitoidentity.py b/tests/test_cognitoidentity/test_cognitoidentity.py
--- a/tests/test_cognitoidentity/test_cognitoidentity.py
+++ b/tests/test_cognitoidentity/test_cognitoidentity.py
@@ -7,6 +7,7 @@
 from moto import mock_cognitoidentity
 from moto.cognitoidentity.utils import get_random_identity_id
 from moto.core import ACCOUNT_ID
+from uuid import UUID
 
 
 @mock_cognitoidentity
@@ -83,8 +84,10 @@ def test_describe_identity_pool_with_invalid_id_raises_error():
 
 # testing a helper function
 def test_get_random_identity_id():
-    assert len(get_random_identity_id("us-west-2")) > 0
-    assert len(get_random_identity_id("us-west-2").split(":")[1]) == 19
+    identity_id = get_random_identity_id("us-west-2")
+    region, id = identity_id.split(":")
+    region.should.equal("us-west-2")
+    UUID(id, version=4)  # Will throw an error if it's not a valid UUID
 
 
 @mock_cognitoidentity
@@ -96,7 +99,6 @@ def test_get_id():
         IdentityPoolId="us-west-2:12345",
         Logins={"someurl": "12345"},
     )
-    print(result)
     assert (
         result.get("IdentityId", "").startswith("us-west-2")
         or result.get("ResponseMetadata").get("HTTPStatusCode") == 200
diff --git a/tests/test_cognitoidentity/test_server.py b/tests/test_cognitoidentity/test_server.py
--- a/tests/test_cognitoidentity/test_server.py
+++ b/tests/test_cognitoidentity/test_server.py
@@ -48,6 +48,5 @@ def test_get_id():
         },
     )
 
-    print(res.data)
     json_data = json.loads(res.data.decode("utf-8"))
     assert ":" in json_data["IdentityId"]