Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

len_checks.py 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # pylint: disable=too-few-public-methods,import-error, no-absolute-import,missing-docstring
  2. # pylint: disable=useless-super-delegation,wrong-import-position,invalid-name, wrong-import-order
  3. if len('TEST'): # [len-as-condition]
  4. pass
  5. while not len('TEST'): # [len-as-condition]
  6. pass
  7. assert len('TEST') > 0 # [len-as-condition]
  8. x = 1 if len('TEST') != 0 else 2 # [len-as-condition]
  9. if len('TEST') == 0: # [len-as-condition]
  10. pass
  11. if True and len('TEST') == 0: # [len-as-condition]
  12. pass
  13. if 0 == len('TEST') < 10: # [len-as-condition]
  14. pass
  15. if 0 < 1 <= len('TEST') < 10: # Should be fine
  16. pass
  17. if 10 > len('TEST') != 0: # [len-as-condition]
  18. pass
  19. z = False
  20. if z and len(['T', 'E', 'S', 'T']): # [len-as-condition]
  21. pass
  22. if 10 > len('TEST') > 1 > 0:
  23. pass
  24. f_o_o = len('TEST') or 42 # Should be fine
  25. a = x and len(x) # Should be fine
  26. if 0 <= len('TEST') < 100: # Should be fine
  27. pass
  28. if z or 10 > len('TEST') != 0: # [len-as-condition]
  29. pass
  30. def some_func():
  31. return len('TEST') > 0 # Should be fine
  32. def github_issue_1325():
  33. l = [1, 2, 3]
  34. length = len(l) if l else 0
  35. return length
  36. def github_issue_1331(*args):
  37. assert False, len(args)
  38. def github_issue_1331_v2(*args):
  39. assert len(args), args # [len-as-condition]
  40. def github_issue_1331_v3(*args):
  41. assert len(args) or z, args # [len-as-condition]