1717
1818
1919class TestLoggingShim (unittest .TestCase ):
20- def test_shim_matches_logging_v2 (self ):
20+ def test_root_shim_matches_logging_v2 (self ):
2121 from google .cloud import logging
2222 from google .cloud import logging_v2
2323
@@ -26,4 +26,43 @@ def test_shim_matches_logging_v2(self):
2626 for name in logging .__all__ :
2727 found = getattr (logging , name )
2828 expected = getattr (logging_v2 , name )
29+ if name == "handlers" :
30+ # handler has separate shim
31+ self .assertTrue (found )
32+ self .assertIs (type (found ), type (expected ))
33+ else :
34+ # other attributes should be identical
35+ self .assertIs (found , expected )
36+
37+ def test_handler_shim_matches_logging_v2 (self ):
38+ from google .cloud .logging import handlers
39+ from google .cloud .logging_v2 import handlers as handlers_2
40+
41+ self .assertEqual (handlers .__all__ , handlers_2 .__all__ )
42+
43+ for name in handlers .__all__ :
44+ found = getattr (handlers , name )
45+ expected = getattr (handlers_2 , name )
46+ self .assertIs (found , expected )
47+
48+ def test_middleware_shim_matches_logging_v2 (self ):
49+ from google .cloud .logging .handlers import middleware
50+ from google .cloud .logging_v2 .handlers import middleware as middleware_2
51+
52+ self .assertEqual (middleware .__all__ , middleware_2 .__all__ )
53+
54+ for name in middleware .__all__ :
55+ found = getattr (middleware , name )
56+ expected = getattr (middleware_2 , name )
57+ self .assertIs (found , expected )
58+
59+ def test_transports_shim_matches_logging_v2 (self ):
60+ from google .cloud .logging .handlers import transports
61+ from google .cloud .logging_v2 .handlers import transports as transports_2
62+
63+ self .assertEqual (transports .__all__ , transports_2 .__all__ )
64+
65+ for name in transports .__all__ :
66+ found = getattr (transports , name )
67+ expected = getattr (transports_2 , name )
2968 self .assertIs (found , expected )
0 commit comments