Skip to content

Commit

Permalink
switch to functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasKrocek committed Jun 5, 2023
1 parent b502545 commit 900b7a4
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 134 deletions.
134 changes: 0 additions & 134 deletions tests/extensions/function_return_not_assigned.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# pylint: disable=missing-function-docstring, missing-module-docstring, missing-class-docstring, expression-not-assigned, invalid-name
from dataclasses import dataclass, replace


def func_that_returns_something():
return 1


func_that_returns_something() # [function-return-not-assigned]

_ = func_that_returns_something()

if func_that_returns_something():
pass


def func_that_returns_none():
return None


def func_with_no_explicit_return():
print("I am doing something")


func_that_returns_none()
func_with_no_explicit_return()

some_var = ""
# next line should probably raise?
func_that_returns_something() if some_var else func_that_returns_none()
_ = func_that_returns_something() if some_var else func_that_returns_none()
func_with_no_explicit_return() if some_var else func_that_returns_none()


@dataclass
class TestClass:
value: int

def return_self(self):
return self

def return_none(self):
pass


inst = TestClass(1)
inst.return_self() # [function-return-not-assigned]
inst.return_none()

replace(inst, value=3) # [function-return-not-assigned]

inst = replace(inst, value=3)

inst.return_self() # [function-return-not-assigned]
inst.return_none()
inst = inst.return_self()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MAIN]
load-plugins=pylint.extensions.function_return_not_assigned,
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function-return-not-assigned:9:0:9:29::Function returned value which is never used:UNDEFINED
function-return-not-assigned:47:0:47:18::Function returned value which is never used:UNDEFINED
function-return-not-assigned:50:0:50:22::Function returned value which is never used:UNDEFINED
function-return-not-assigned:54:0:54:18::Function returned value which is never used:UNDEFINED
Empty file.

0 comments on commit 900b7a4

Please sign in to comment.