@@ -2075,11 +2075,9 @@ def test_generate_span_id_avoids_invalid(self, mock_getrandbits):
2075
2075
generator = RandomIdGenerator ()
2076
2076
span_id = generator .generate_span_id ()
2077
2077
2078
- self .assertGreater (span_id , trace_api .INVALID_SPAN_ID )
2079
- self .assertLessEqual (span_id , self ._SPAN_ID_MAX_VALUE )
2080
- self .assertEqual (
2081
- mock_getrandbits .call_count , 2
2082
- ) # Ensure exactly two calls
2078
+ self .assertNotEqual (span_id , trace_api .INVALID_SPAN_ID )
2079
+ mock_getrandbits .assert_any_call (64 )
2080
+ self .assertEqual (mock_getrandbits .call_count , 2 )
2083
2081
2084
2082
@patch (
2085
2083
"random.getrandbits" ,
@@ -2092,8 +2090,6 @@ def test_generate_trace_id_avoids_invalid(self, mock_getrandbits):
2092
2090
generator = RandomIdGenerator ()
2093
2091
trace_id = generator .generate_trace_id ()
2094
2092
2095
- self .assertGreater (trace_id , trace_api .INVALID_TRACE_ID )
2096
- self .assertLessEqual (trace_id , self ._TRACE_ID_MAX_VALUE )
2097
- self .assertEqual (
2098
- mock_getrandbits .call_count , 2
2099
- ) # Ensure exactly two calls
2093
+ self .assertNotEqual (trace_id , trace_api .INVALID_TRACE_ID )
2094
+ mock_getrandbits .assert_any_call (128 )
2095
+ self .assertEqual (mock_getrandbits .call_count , 2 )
0 commit comments