@@ -31,6 +31,7 @@ mod tests {
31
31
#[ test_case( Rule :: SnmpWeakCryptography , Path :: new( "S509.py" ) ; "S509" ) ]
32
32
#[ test_case( Rule :: LoggingConfigInsecureListen , Path :: new( "S612.py" ) ; "S612" ) ]
33
33
#[ test_case( Rule :: Jinja2AutoescapeFalse , Path :: new( "S701.py" ) ; "S701" ) ]
34
+ #[ test_case( Rule :: TryExceptPass , Path :: new( "S110.py" ) ; "S110" ) ]
34
35
fn rules ( rule_code : Rule , path : & Path ) -> Result < ( ) > {
35
36
let snapshot = format ! ( "{}_{}" , rule_code. code( ) , path. to_string_lossy( ) ) ;
36
37
let diagnostics = test_path (
@@ -55,11 +56,27 @@ mod tests {
55
56
"/dev/shm" . to_string( ) ,
56
57
"/foo" . to_string( ) ,
57
58
] ,
59
+ check_typed_exception : false ,
58
60
} ,
59
61
..Settings :: for_rule ( Rule :: HardcodedTempFile )
60
62
} ,
61
63
) ?;
62
64
assert_yaml_snapshot ! ( "S108_extend" , diagnostics) ;
63
65
Ok ( ( ) )
64
66
}
67
+
68
+ #[ test]
69
+ fn check_typed_exception ( ) -> Result < ( ) > {
70
+ let mut settings: super :: settings:: Settings = Default :: default ( ) ;
71
+ settings. check_typed_exception = true ;
72
+ let diagnostics = test_path (
73
+ Path :: new ( "./resources/test/fixtures/flake8_bandit/S110.py" ) ,
74
+ & Settings {
75
+ flake8_bandit : settings,
76
+ ..Settings :: for_rule ( Rule :: TryExceptPass )
77
+ } ,
78
+ ) ?;
79
+ assert_yaml_snapshot ! ( "S110_typed" , diagnostics) ;
80
+ Ok ( ( ) )
81
+ }
65
82
}
0 commit comments