Skip to content

Files

Latest commit

 

History

History
19 lines (12 loc) · 385 Bytes

assert-on-string-literal.md

File metadata and controls

19 lines (12 loc) · 385 Bytes

Pattern: Use of assert on string literal

Issue: -

Description

Used when an assert statement has a string literal as its first argument, which will cause the assert to always pass.

Example of incorrect code:

assert "There is an AssertionError" # [assert-on-string-literal]

Example of correct code:

assert [foo, bar], "No AssertionError"