From cb661e303750f52d2674947fea8f438d398effdc Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Tue, 10 Nov 2020 22:15:24 -0800 Subject: [PATCH] Remove unecessary dict casting --- .../tests/test_botocore_instrumentation.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py index dc7f945ea4..fdb0012245 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py @@ -58,7 +58,7 @@ def test_traced_client(self): span = spans[0] self.assertEqual(len(spans), 1) self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "DescribeInstances", "aws.region": "us-west-2", @@ -106,7 +106,7 @@ def test_s3_client(self): span = spans[0] self.assertEqual(len(spans), 2) self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "ListBuckets", "aws.region": "us-west-2", @@ -123,7 +123,7 @@ def test_s3_client(self): assert spans span = spans[2] self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "ListObjects", "aws.region": "us-west-2", @@ -144,7 +144,7 @@ def test_s3_put(self): spans = self.memory_exporter.get_finished_spans() assert spans self.assertEqual(len(spans), 3) - create_bucket_attributes = dict(spans[0].attributes) + create_bucket_attributes = spans[0].attributes self.assertEqual( create_bucket_attributes, { @@ -154,7 +154,7 @@ def test_s3_put(self): "http.status_code": 200, }, ) - put_object_attributes = dict(spans[1].attributes) + put_object_attributes = spans[1].attributes self.assertEqual( put_object_attributes, { @@ -165,7 +165,7 @@ def test_s3_put(self): }, ) self.assertTrue("params.Body" not in spans[1].attributes.keys()) - get_object_attributes = dict(spans[2].attributes) + get_object_attributes = spans[2].attributes self.assertEqual( get_object_attributes, { @@ -186,7 +186,7 @@ def test_sqs_client(self): assert spans span = spans[0] self.assertEqual(len(spans), 1) - actual = dict(span.attributes) + actual = span.attributes self.assertRegex(actual["aws.request_id"], r"[A-Z0-9]{52}") del actual["aws.request_id"] self.assertEqual( @@ -214,7 +214,7 @@ def test_sqs_send_message(self): spans = self.memory_exporter.get_finished_spans() assert spans self.assertEqual(len(spans), 2) - create_queue_attributes = dict(spans[0].attributes) + create_queue_attributes = spans[0].attributes self.assertRegex( create_queue_attributes["aws.request_id"], r"[A-Z0-9]{52}" ) @@ -228,7 +228,7 @@ def test_sqs_send_message(self): "http.status_code": 200, }, ) - send_msg_attributes = dict(spans[1].attributes) + send_msg_attributes = spans[1].attributes self.assertRegex( send_msg_attributes["aws.request_id"], r"[A-Z0-9]{52}" ) @@ -257,7 +257,7 @@ def test_kinesis_client(self): span = spans[0] self.assertEqual(len(spans), 1) self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "ListStreams", "aws.region": "us-east-1", @@ -302,7 +302,7 @@ def test_lambda_client(self): span = spans[0] self.assertEqual(len(spans), 1) self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "ListFunctions", "aws.region": "us-east-1", @@ -322,7 +322,7 @@ def test_kms_client(self): span = spans[0] self.assertEqual(len(spans), 1) self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "ListKeys", "aws.region": "us-east-1", @@ -345,7 +345,7 @@ def test_sts_client(self): span = spans[0] self.assertEqual(len(spans), 1) self.assertEqual( - dict(span.attributes), + span.attributes, { "aws.operation": "GetCallerIdentity", "aws.region": "us-east-1", @@ -383,7 +383,7 @@ def test_dynamodb_client(self): spans = self.memory_exporter.get_finished_spans() assert spans self.assertEqual(len(spans), 3) - create_table_attributes = dict(spans[0].attributes) + create_table_attributes = spans[0].attributes self.assertRegex( create_table_attributes["aws.request_id"], r"[A-Z0-9]{52}" ) @@ -398,7 +398,7 @@ def test_dynamodb_client(self): "http.status_code": 200, }, ) - put_item_attributes = dict(spans[1].attributes) + put_item_attributes = spans[1].attributes self.assertRegex( put_item_attributes["aws.request_id"], r"[A-Z0-9]{52}" ) @@ -413,7 +413,7 @@ def test_dynamodb_client(self): "http.status_code": 200, }, ) - get_item_attributes = dict(spans[2].attributes) + get_item_attributes = spans[2].attributes self.assertRegex( get_item_attributes["aws.request_id"], r"[A-Z0-9]{52}" )