Python: Expand test of py/use-of-input

This commit is contained in:
Rasmus Wriedt Larsen
2021-05-20 14:52:10 +02:00
parent 0292ca6b67
commit f17fe442a2
2 changed files with 15 additions and 4 deletions

View File

@@ -1,2 +1,2 @@
| UseofApply.py:19:3:19:17 | ControlFlowNode for apply() | Call to the obsolete builtin function 'apply'. |
| expressions_test.py:3:5:3:21 | ControlFlowNode for apply() | Call to the obsolete builtin function 'apply'. |
| expressions_test.py:2:5:2:21 | ControlFlowNode for apply() | Call to the obsolete builtin function 'apply'. |

View File

@@ -1,7 +1,18 @@
def use_of_apply(func, args):
apply(func, args)
def use_of_input():
return input()
def use_of_input():
return input() # NOT OK
def not_use_of_input():
input = raw_input
return input() # OK
if __name__ == "__main__":
# if you enter 4+4 each time, you'll see that results are: 8, '4+4', 8
print("result:", use_of_input())
print("result:", not_use_of_input())
print("result:", use_of_input())