---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLW0129 Asserting on a non-empty string literal will always pass
 --> assert_on_string_literal.py:3:12
  |
1 | def test_division():
2 |     a = 9 / 3
3 |     assert "No ZeroDivisionError were raised"  # [assert-on-string-literal]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |

PLW0129 Asserting on a non-empty string literal will always pass
  --> assert_on_string_literal.py:12:12
   |
11 | try:
12 |     assert "bad"  # [assert-on-string-literal]
   |            ^^^^^
13 | except:
14 |     assert "bad again"  # [assert-on-string-literal]
   |

PLW0129 Asserting on a non-empty string literal will always pass
  --> assert_on_string_literal.py:14:12
   |
12 |     assert "bad"  # [assert-on-string-literal]
13 | except:
14 |     assert "bad again"  # [assert-on-string-literal]
   |            ^^^^^^^^^^^
15 |
16 | a = 12
   |

PLW0129 Asserting on a non-empty string literal will always pass
  --> assert_on_string_literal.py:17:8
   |
16 | a = 12
17 | assert f"hello {a}"  # [assert-on-string-literal]
   |        ^^^^^^^^^^^^
18 | assert f"{a}"  # [assert-on-string-literal]
19 | assert f""  # [assert-on-string-literal]
   |

PLW0129 Asserting on a string literal may have unintended results
  --> assert_on_string_literal.py:18:8
   |
16 | a = 12
17 | assert f"hello {a}"  # [assert-on-string-literal]
18 | assert f"{a}"  # [assert-on-string-literal]
   |        ^^^^^^
19 | assert f""  # [assert-on-string-literal]
20 | assert ""  # [assert-on-string-literal]
   |

PLW0129 Asserting on an empty string literal will never pass
  --> assert_on_string_literal.py:19:8
   |
17 | assert f"hello {a}"  # [assert-on-string-literal]
18 | assert f"{a}"  # [assert-on-string-literal]
19 | assert f""  # [assert-on-string-literal]
   |        ^^^
20 | assert ""  # [assert-on-string-literal]
21 | assert b"hello"  # [assert-on-string-literal]
   |

PLW0129 Asserting on an empty string literal will never pass
  --> assert_on_string_literal.py:20:8
   |
18 | assert f"{a}"  # [assert-on-string-literal]
19 | assert f""  # [assert-on-string-literal]
20 | assert ""  # [assert-on-string-literal]
   |        ^^
21 | assert b"hello"  # [assert-on-string-literal]
22 | assert "", b"hi"  # [assert-on-string-literal]
   |

PLW0129 Asserting on a non-empty string literal will always pass
  --> assert_on_string_literal.py:21:8
   |
19 | assert f""  # [assert-on-string-literal]
20 | assert ""  # [assert-on-string-literal]
21 | assert b"hello"  # [assert-on-string-literal]
   |        ^^^^^^^^
22 | assert "", b"hi"  # [assert-on-string-literal]
23 | assert "WhyNotHere?", "HereIsOk"  # [assert-on-string-literal]
   |

PLW0129 Asserting on an empty string literal will never pass
  --> assert_on_string_literal.py:22:8
   |
20 | assert ""  # [assert-on-string-literal]
21 | assert b"hello"  # [assert-on-string-literal]
22 | assert "", b"hi"  # [assert-on-string-literal]
   |        ^^
23 | assert "WhyNotHere?", "HereIsOk"  # [assert-on-string-literal]
24 | assert 12, "ok here"
   |

PLW0129 Asserting on a non-empty string literal will always pass
  --> assert_on_string_literal.py:23:8
   |
21 | assert b"hello"  # [assert-on-string-literal]
22 | assert "", b"hi"  # [assert-on-string-literal]
23 | assert "WhyNotHere?", "HereIsOk"  # [assert-on-string-literal]
   |        ^^^^^^^^^^^^^
24 | assert 12, "ok here"
   |
