File tree 2 files changed +13
-13
lines changed
2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -764,6 +764,19 @@ the provided type.
764
764
765
765
assert_type([1 ], list[str ]) # Error
766
766
767
+ Check that function isn't used in boolean context [truthy-function]
768
+ -------------------------------------------------------------------
769
+
770
+ Functions will always evaluate to true in boolean contexts.
771
+
772
+ .. code-block :: python
773
+
774
+ def f ():
775
+ ...
776
+
777
+ if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
778
+ pass
779
+
767
780
Report syntax errors [syntax]
768
781
-----------------------------
769
782
Original file line number Diff line number Diff line change @@ -256,19 +256,6 @@ what the author might have intended. Of course it's possible that ``transform``
256
256
and so there is no error in practice. In such case, it is recommended to annotate ``items: Collection[int] ``.
257
257
258
258
259
- Check that function isn't used in boolean context [truthy-function]
260
- -------------------------------------------------------------------
261
-
262
- Functions will always evaluate to true in boolean contexts.
263
-
264
- .. code-block :: python
265
-
266
- def f ():
267
- ...
268
-
269
- if f: # Error: Function "Callable[[], Any]" could always be true in boolean context [truthy-function]
270
- pass
271
-
272
259
.. _ignore-without-code :
273
260
274
261
Check that ``# type: ignore `` include an error code [ignore-without-code]
You can’t perform that action at this time.
0 commit comments