Skip to content

Commit

Permalink
bug fix, pass the lint check
Browse files Browse the repository at this point in the history
  • Loading branch information
zhihali committed Jun 12, 2024
1 parent fb5dff6 commit 5618966
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions opentelemetry-sdk/tests/trace/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
StatusCode,
get_tracer,
set_tracer_provider,
span,
)


Expand Down Expand Up @@ -2070,14 +2069,13 @@ class TestRandomIdGenerator(unittest.TestCase):

@patch(
"random.getrandbits",
side_effect=[span.INVALID_SPAN_ID, 0x00000000DEADBEF0],
side_effect=[trace_api.INVALID_SPAN_ID, 0x00000000DEADBEF0],
)
def test_generate_span_id_avoids_invalid(self, mock_getrandbits):
generator = RandomIdGenerator()
span_id = generator.generate_span_id()

self.assertNotEqual(span_id, span.INVALID_SPAN_ID)
self.assertGreater(span_id, span.INVALID_SPAN_ID)
self.assertGreater(span_id, trace_api.INVALID_SPAN_ID)
self.assertLessEqual(span_id, self._SPAN_ID_MAX_VALUE)
self.assertEqual(
mock_getrandbits.call_count, 2
Expand All @@ -2086,16 +2084,15 @@ def test_generate_span_id_avoids_invalid(self, mock_getrandbits):
@patch(
"random.getrandbits",
side_effect=[
span.INVALID_TRACE_ID,
trace_api.INVALID_TRACE_ID,
0x000000000000000000000000DEADBEEF,
],
)
def test_generate_trace_id_avoids_invalid(self, mock_getrandbits):
generator = RandomIdGenerator()
trace_id = generator.generate_trace_id()

self.assertNotEqual(trace_id, span.INVALID_TRACE_ID)
self.assertGreater(trace_id, span.INVALID_TRACE_ID)
self.assertGreater(trace_id, trace_api.INVALID_TRACE_ID)
self.assertLessEqual(trace_id, self._TRACE_ID_MAX_VALUE)
self.assertEqual(
mock_getrandbits.call_count, 2
Expand Down

0 comments on commit 5618966

Please sign in to comment.