@@ -771,7 +771,7 @@ def test_iteration(lop):
771771
772772 wrapper = lop .Proxy (lambda : items )
773773
774- result = [x for x in wrapper ]
774+ result = [x for x in wrapper ] # noqa: C416
775775
776776 assert result == items
777777
@@ -816,13 +816,11 @@ def function1(*args, **kwargs):
816816
817817 function2 = lop .Proxy (lambda : function1 )
818818
819- table = dict ()
820- table [function1 ] = True
819+ table = {function1 : True }
821820
822821 assert table .get (function2 )
823822
824- table = dict ()
825- table [function2 ] = True
823+ table = {function2 : True }
826824
827825 assert table .get (function1 )
828826
@@ -1458,12 +1456,12 @@ def test_repr_doesnt_consume(lop):
14581456def test_derived_new (lop ):
14591457 class DerivedObjectProxy (lop .Proxy ):
14601458 def __new__ (cls , wrapped ):
1461- instance = super (DerivedObjectProxy , cls ).__new__ (cls )
1459+ instance = super ().__new__ (cls )
14621460 instance .__init__ (wrapped )
14631461 return instance
14641462
14651463 def __init__ (self , wrapped ):
1466- super (DerivedObjectProxy , self ).__init__ (wrapped )
1464+ super ().__init__ (wrapped )
14671465
14681466 def function ():
14691467 return 123
@@ -1540,9 +1538,9 @@ class DerivedObjectProxy(lop.Proxy):
15401538 def __getattr__ (self , name ):
15411539 accessed .append (name )
15421540 try :
1543- __getattr__ = super (DerivedObjectProxy , self ).__getattr__
1541+ __getattr__ = super ().__getattr__
15441542 except AttributeError as e :
1545- raise RuntimeError (str (e ))
1543+ raise RuntimeError (str (e )) from e
15461544 return __getattr__ (name )
15471545
15481546 function .attribute = 1
@@ -1884,7 +1882,7 @@ class LazyProxy(lop.Proxy):
18841882 name = None
18851883
18861884 def __init__ (self , func , ** lazy_attr ):
1887- super (LazyProxy , self ).__init__ (func )
1885+ super ().__init__ (func )
18881886 for attr , val in lazy_attr .items ():
18891887 setattr (self , attr , val )
18901888
@@ -1904,7 +1902,7 @@ class Foo:
19041902
19051903 class LazyProxy (lop .Proxy ):
19061904 def __init__ (self , func , ** lazy_attr ):
1907- super (LazyProxy , self ).__init__ (func )
1905+ super ().__init__ (func )
19081906 for attr , val in lazy_attr .items ():
19091907 object .__setattr__ (self , attr , val )
19101908
@@ -1915,20 +1913,20 @@ def __init__(self, func, **lazy_attr):
19151913
19161914class FSPathMock :
19171915 def __fspath__ (self ):
1918- return '/tmp '
1916+ return '/foobar '
19191917
19201918
19211919@pytest .mark .skipif (not hasattr (os , 'fspath' ), reason = 'No os.fspath support.' )
19221920def test_fspath (lop ):
1923- assert os .fspath (lop .Proxy (lambda : '/tmp ' )) == '/tmp '
1924- assert os .fspath (lop .Proxy (FSPathMock )) == '/tmp '
1921+ assert os .fspath (lop .Proxy (lambda : '/foobar ' )) == '/foobar '
1922+ assert os .fspath (lop .Proxy (FSPathMock )) == '/foobar '
19251923 with pytest .raises (TypeError ) as excinfo :
19261924 os .fspath (lop .Proxy (lambda : None ))
19271925 assert '__fspath__() to return str or bytes, not NoneType' in excinfo .value .args [0 ]
19281926
19291927
19301928def test_fspath_method (lop ):
1931- assert lop .Proxy (FSPathMock ).__fspath__ () == '/tmp '
1929+ assert lop .Proxy (FSPathMock ).__fspath__ () == '/foobar '
19321930
19331931
19341932def test_resolved_new (lop ):
0 commit comments