File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Tests for correlation ID generation."""
22
3- from typing import final , override
3+ from typing import cast , override
44
55import pytest
66
@@ -49,19 +49,22 @@ def test_hash_correlation_provider_with_invalid_input() -> None:
4949 provider = HashCorrelationProvider ()
5050
5151 # Create an object that raises an exception when converted to string
52- @final
53- class BadStr (str ):
54- __slots__ = ()
55-
52+ class BadStr :
5653 @override
5754 def __str__ (self ) -> str :
5855 error_msg = "Cannot convert to string"
5956 raise ValueError (error_msg )
6057
58+ string = BadStr ()
59+
60+ # do bad stuff to get around type issues
61+ string = cast ("object" , string )
62+ string = cast ("str" , string )
63+
6164 with pytest .raises (
6265 ValueError , match = "Failed to generate correlation ID from input"
6366 ):
64- _ = provider .get_correlation_id (BadStr () )
67+ _ = provider .get_correlation_id (string )
6568
6669
6770def test_hash_correlation_provider_consistency () -> None :
You can’t perform that action at this time.
0 commit comments