Skip to content

Commit 95f3a65

Browse files
committed
CheckStyle Fix && Code Style Fix
1 parent 85078d0 commit 95f3a65

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_metric_attributes_span_exporter.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
from opentelemetry.trace import SpanContext, SpanKind
2222
from opentelemetry.util.types import Attributes
2323

24+
_CONTAINS_ATTRIBUTES: bool = True
25+
_CONTAINS_NO_ATTRIBUTES: bool = False
26+
2427

2528
class TestAwsMetricAttributesSpanExporter(TestCase):
26-
_CONTAINS_ATTRIBUTES: bool = True
27-
_CONTAINS_NO_ATTRIBUTES: bool = False
2829

2930
def setUp(self):
3031
self.delegate_mock: SpanExporter = MagicMock()
@@ -40,9 +41,9 @@ def test_pass_through_delegations(self):
4041
self.delegate_mock.assert_has_calls([call.force_flush(30000), call.shutdown()])
4142

4243
def test_export_delegation_without_attributes_or_modification(self):
43-
span_attributes: Attributes = _build_span_attributes(self._CONTAINS_NO_ATTRIBUTES)
44+
span_attributes: Attributes = _build_span_attributes(_CONTAINS_NO_ATTRIBUTES)
4445
span_data_mock: ReadableSpan = _build_readable_span_mock(span_attributes)
45-
metric_attributes: Attributes = _build_metric_attributes(self._CONTAINS_NO_ATTRIBUTES)
46+
metric_attributes: Attributes = _build_metric_attributes(_CONTAINS_NO_ATTRIBUTES)
4647
self.__configure_mock_for_export(span_data_mock, metric_attributes)
4748

4849
self.aws_metric_attributes_span_exporter.export([span_data_mock])
@@ -53,9 +54,9 @@ def test_export_delegation_without_attributes_or_modification(self):
5354
self.assertEqual(span_data_mock, exported_span)
5455

5556
def test_export_delegation_with_attributes_but_without_modification(self):
56-
span_attributes: Attributes = _build_span_attributes(self._CONTAINS_ATTRIBUTES)
57+
span_attributes: Attributes = _build_span_attributes(_CONTAINS_ATTRIBUTES)
5758
span_data_mock: ReadableSpan = _build_readable_span_mock(span_attributes)
58-
metric_attributes: Attributes = _build_metric_attributes(self._CONTAINS_NO_ATTRIBUTES)
59+
metric_attributes: Attributes = _build_metric_attributes(_CONTAINS_NO_ATTRIBUTES)
5960
self.__configure_mock_for_export(span_data_mock, metric_attributes)
6061

6162
self.aws_metric_attributes_span_exporter.export([span_data_mock])
@@ -66,9 +67,9 @@ def test_export_delegation_with_attributes_but_without_modification(self):
6667
self.assertEqual(span_data_mock, exported_span)
6768

6869
def test_export_delegation_without_attributes_but_with_modification(self):
69-
span_attributes: Attributes = _build_span_attributes(self._CONTAINS_NO_ATTRIBUTES)
70+
span_attributes: Attributes = _build_span_attributes(_CONTAINS_NO_ATTRIBUTES)
7071
span_data_mock: ReadableSpan = _build_readable_span_mock(span_attributes)
71-
metric_attributes: Attributes = _build_metric_attributes(self._CONTAINS_ATTRIBUTES)
72+
metric_attributes: Attributes = _build_metric_attributes(_CONTAINS_ATTRIBUTES)
7273
self.__configure_mock_for_export(span_data_mock, metric_attributes)
7374

7475
self.aws_metric_attributes_span_exporter.export([span_data_mock])
@@ -82,9 +83,9 @@ def test_export_delegation_without_attributes_but_with_modification(self):
8283
self.assertEqual(exported_span._attributes[key], value)
8384

8485
def test_export_delegation_with_attributes_and_modification(self):
85-
span_attributes: Attributes = _build_span_attributes(self._CONTAINS_ATTRIBUTES)
86+
span_attributes: Attributes = _build_span_attributes(_CONTAINS_ATTRIBUTES)
8687
span_data_mock: ReadableSpan = _build_readable_span_mock(span_attributes)
87-
metric_attributes: Attributes = _build_metric_attributes(self._CONTAINS_ATTRIBUTES)
88+
metric_attributes: Attributes = _build_metric_attributes(_CONTAINS_ATTRIBUTES)
8889
self.__configure_mock_for_export(span_data_mock, metric_attributes)
8990

9091
self.aws_metric_attributes_span_exporter.export([span_data_mock])
@@ -98,15 +99,15 @@ def test_export_delegation_with_attributes_and_modification(self):
9899
self.assertEqual(exported_span._attributes[key], value)
99100

100101
def test_export_delegation_with_multiple_spans(self):
101-
span_data_mock1: ReadableSpan = _build_readable_span_mock(_build_span_attributes(self._CONTAINS_NO_ATTRIBUTES))
102-
metric_attributes1: Attributes = _build_metric_attributes(self._CONTAINS_NO_ATTRIBUTES)
102+
span_data_mock1: ReadableSpan = _build_readable_span_mock(_build_span_attributes(_CONTAINS_NO_ATTRIBUTES))
103+
metric_attributes1: Attributes = _build_metric_attributes(_CONTAINS_NO_ATTRIBUTES)
103104

104-
span_attributes2: Attributes = _build_span_attributes(self._CONTAINS_ATTRIBUTES)
105+
span_attributes2: Attributes = _build_span_attributes(_CONTAINS_ATTRIBUTES)
105106
span_data_mock2: ReadableSpan = _build_readable_span_mock(span_attributes2)
106-
metric_attributes2: Attributes = _build_metric_attributes(self._CONTAINS_ATTRIBUTES)
107+
metric_attributes2: Attributes = _build_metric_attributes(_CONTAINS_ATTRIBUTES)
107108

108-
span_data_mock3: ReadableSpan = _build_readable_span_mock(_build_span_attributes(self._CONTAINS_ATTRIBUTES))
109-
metric_attributes3: Attributes = _build_metric_attributes(self._CONTAINS_NO_ATTRIBUTES)
109+
span_data_mock3: ReadableSpan = _build_readable_span_mock(_build_span_attributes(_CONTAINS_ATTRIBUTES))
110+
metric_attributes3: Attributes = _build_metric_attributes(_CONTAINS_NO_ATTRIBUTES)
110111

111112
self.__configure_mock_for_export_with_multiple_side_effect(
112113
[span_data_mock1, span_data_mock2, span_data_mock3],
@@ -152,9 +153,9 @@ def test_overridden_attributes(self):
152153
self.assertEqual(exported_span._attributes["key3"], "new value3")
153154

154155
def test_export_delegating_span_data_behaviour(self):
155-
span_attributes = _build_span_attributes(self._CONTAINS_ATTRIBUTES)
156+
span_attributes = _build_span_attributes(_CONTAINS_ATTRIBUTES)
156157
span_data_mock = _build_readable_span_mock_without_deepcopy_support(span_attributes)
157-
metric_attributes = _build_metric_attributes(self._CONTAINS_ATTRIBUTES)
158+
metric_attributes = _build_metric_attributes(_CONTAINS_ATTRIBUTES)
158159
self.__configure_mock_for_export(span_data_mock, metric_attributes)
159160

160161
self.aws_metric_attributes_span_exporter.export([span_data_mock])
@@ -200,7 +201,7 @@ def test_export_delegating_span_data_behaviour(self):
200201
self.assertEqual(exported_span.status, status_mock)
201202

202203
def test_export_delegation_with_two_metrics(self):
203-
span_attributes = _build_span_attributes(self._CONTAINS_ATTRIBUTES)
204+
span_attributes = _build_span_attributes(_CONTAINS_ATTRIBUTES)
204205

205206
span_data_mock = MagicMock()
206207
span_data_mock._attributes = span_attributes
@@ -276,7 +277,7 @@ def test_consumer_process_span_has_empty_attribute(self):
276277
self.assertEqual(exported_span, span_data_mock)
277278

278279
def test_export_delegation_with_dependency_metrics(self):
279-
span_attributes = _build_span_attributes(self._CONTAINS_ATTRIBUTES)
280+
span_attributes = _build_span_attributes(_CONTAINS_ATTRIBUTES)
280281
span_data_mock: ReadableSpan = MagicMock()
281282
span_context_mock: SpanContext = SpanContext(1, 1, False)
282283
span_data_mock.attributes = span_attributes
@@ -327,7 +328,7 @@ def generate_metric_attribute_map_side_effect(span, resource):
327328
)
328329

329330
def __configure_mock_for_export_with_multiple_side_effect(
330-
self, span_data_mocks: [ReadableSpan], metric_attributes_list: [Attributes]
331+
self, span_data_mocks: [ReadableSpan], metric_attributes_list: [Attributes]
331332
):
332333
attributes_map_list: list = []
333334
for span in span_data_mocks:

0 commit comments

Comments
 (0)