@@ -1250,6 +1250,30 @@ mod tests {
12501250 assert_lexed_ranges_match_slices ( directive, source) ;
12511251 }
12521252
1253+ #[ test]
1254+ fn noqa_no_code ( ) {
1255+ let source = "# noqa:" ;
1256+ let directive = lex_inline_noqa ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1257+ assert_debug_snapshot ! ( directive) ;
1258+ assert_lexed_ranges_match_slices ( directive, source) ;
1259+ }
1260+
1261+ #[ test]
1262+ fn noqa_no_code_invalid_suffix ( ) {
1263+ let source = "# noqa: foo" ;
1264+ let directive = lex_inline_noqa ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1265+ assert_debug_snapshot ! ( directive) ;
1266+ assert_lexed_ranges_match_slices ( directive, source) ;
1267+ }
1268+
1269+ #[ test]
1270+ fn noqa_no_code_trailing_content ( ) {
1271+ let source = "# noqa: # Foo" ;
1272+ let directive = lex_inline_noqa ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1273+ assert_debug_snapshot ! ( directive) ;
1274+ assert_lexed_ranges_match_slices ( directive, source) ;
1275+ }
1276+
12531277 #[ test]
12541278 fn noqa_code ( ) {
12551279 let source = "# noqa: F401" ;
@@ -1482,6 +1506,30 @@ mod tests {
14821506 assert_lexed_ranges_match_slices ( exemption, source) ;
14831507 }
14841508
1509+ #[ test]
1510+ fn flake8_noqa_no_code ( ) {
1511+ let source = "# flake8: noqa:" ;
1512+ let exemption = lex_file_exemption ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1513+ assert_debug_snapshot ! ( exemption) ;
1514+ assert_lexed_ranges_match_slices ( exemption, source) ;
1515+ }
1516+
1517+ #[ test]
1518+ fn flake8_noqa_no_code_invalid_suffix ( ) {
1519+ let source = "# flake8: noqa: foo" ;
1520+ let exemption = lex_file_exemption ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1521+ assert_debug_snapshot ! ( exemption) ;
1522+ assert_lexed_ranges_match_slices ( exemption, source) ;
1523+ }
1524+
1525+ #[ test]
1526+ fn flake8_noqa_no_code_trailing_content ( ) {
1527+ let source = "# flake8: noqa: # Foo" ;
1528+ let exemption = lex_file_exemption ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1529+ assert_debug_snapshot ! ( exemption) ;
1530+ assert_lexed_ranges_match_slices ( exemption, source) ;
1531+ }
1532+
14851533 #[ test]
14861534 fn ruff_exemption_all ( ) {
14871535 let source = "# ruff: noqa" ;
@@ -1490,6 +1538,30 @@ mod tests {
14901538 assert_lexed_ranges_match_slices ( exemption, source) ;
14911539 }
14921540
1541+ #[ test]
1542+ fn ruff_noqa_no_code ( ) {
1543+ let source = "# ruff: noqa:" ;
1544+ let exemption = lex_file_exemption ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1545+ assert_debug_snapshot ! ( exemption) ;
1546+ assert_lexed_ranges_match_slices ( exemption, source) ;
1547+ }
1548+
1549+ #[ test]
1550+ fn ruff_noqa_no_code_invalid_suffix ( ) {
1551+ let source = "# ruff: noqa: foo" ;
1552+ let exemption = lex_file_exemption ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1553+ assert_debug_snapshot ! ( exemption) ;
1554+ assert_lexed_ranges_match_slices ( exemption, source) ;
1555+ }
1556+
1557+ #[ test]
1558+ fn ruff_noqa_no_code_trailing_content ( ) {
1559+ let source = "# ruff: noqa: # Foo" ;
1560+ let exemption = lex_file_exemption ( TextRange :: up_to ( source. text_len ( ) ) , source) ;
1561+ assert_debug_snapshot ! ( exemption) ;
1562+ assert_lexed_ranges_match_slices ( exemption, source) ;
1563+ }
1564+
14931565 #[ test]
14941566 fn flake8_exemption_all_no_space ( ) {
14951567 let source = "#flake8:noqa" ;
0 commit comments