Skip to content

Commit 8567e8b

Browse files
Fix object references in test harnesses.
1 parent f7e9cab commit 8567e8b

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

tests/test_function_wrapper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import unittest
44

55
import wrapt
6-
import wrapt.wrappers
76

87
from compat import PY2, PY3, exec_
98

tests/test_object_proxy.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ def test_self_keyword_argument_on_dict(self):
18521852
# A dict when given self as keyword argument uses it to create item in
18531853
# the dict and no attempt is made to use a positional argument.
18541854

1855-
d = wrapt.wrappers.CallableObjectProxy(dict)(self='self')
1855+
d = wrapt.CallableObjectProxy(dict)(self='self')
18561856

18571857
self.assertEqual(d, dict(self='self'))
18581858

@@ -1867,7 +1867,7 @@ def __init__(self, *args, **kwargs):
18671867
self.assertEqual(o._args, ('arg1',))
18681868
self.assertEqual(o._kwargs, {})
18691869

1870-
o = wrapt.wrappers.CallableObjectProxy(Object)('arg1')
1870+
o = wrapt.CallableObjectProxy(Object)('arg1')
18711871

18721872
self.assertEqual(o._args, ('arg1',))
18731873
self.assertEqual(o._kwargs, {})
@@ -1884,7 +1884,7 @@ def __init__(self, *args, **kwargs):
18841884
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
18851885

18861886
with self.assertRaises(TypeError) as e:
1887-
wrapt.wrappers.CallableObjectProxy(Object)(self='self')
1887+
wrapt.CallableObjectProxy(Object)(self='self')
18881888

18891889
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
18901890

@@ -1900,7 +1900,7 @@ def __init__(self, *args, **kwargs):
19001900
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
19011901

19021902
with self.assertRaises(TypeError) as e:
1903-
wrapt.wrappers.CallableObjectProxy(Object)(arg1='arg1', self='self')
1903+
wrapt.CallableObjectProxy(Object)(arg1='arg1', self='self')
19041904

19051905
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
19061906

@@ -1915,7 +1915,7 @@ def __init__(_self, *args, **kwargs):
19151915
self.assertEqual(o._args, ())
19161916
self.assertEqual(o._kwargs, dict(self="self"))
19171917

1918-
o = wrapt.wrappers.CallableObjectProxy(Object)(self='self')
1918+
o = wrapt.CallableObjectProxy(Object)(self='self')
19191919

19201920
self.assertEqual(o._args, ())
19211921
self.assertEqual(o._kwargs, dict(self="self"))
@@ -1933,7 +1933,7 @@ def __init__(_self, self, *args, **kwargs):
19331933
self.assertEqual(o._kwargs, {})
19341934
self.assertEqual(o._self, 'self')
19351935

1936-
o = wrapt.wrappers.CallableObjectProxy(Object)(self='self')
1936+
o = wrapt.CallableObjectProxy(Object)(self='self')
19371937

19381938
self.assertEqual(o._args, ())
19391939
self.assertEqual(o._kwargs, {})
@@ -1952,7 +1952,7 @@ def __init__(_self, self, *args, **kwargs):
19521952
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument '_self'.*", str(e.exception)), None)
19531953

19541954
with self.assertRaises(TypeError) as e:
1955-
wrapt.wrappers.CallableObjectProxy(Object)(_self='self')
1955+
wrapt.CallableObjectProxy(Object)(_self='self')
19561956

19571957
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument '_self'.*", str(e.exception)), None)
19581958

@@ -1962,7 +1962,7 @@ def test_self_keyword_argument_on_dict_1(self):
19621962
# A dict when given self as keyword argument uses it to create item in
19631963
# the dict and no attempt is made to use a positional argument.
19641964

1965-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(dict, arg1='arg1')
1965+
wrapper = wrapt.PartialCallableObjectProxy(dict, arg1='arg1')
19661966

19671967
d = wrapper(self='self')
19681968

@@ -1972,7 +1972,7 @@ def test_self_keyword_argument_on_dict_2(self):
19721972
# A dict when given self as keyword argument uses it to create item in
19731973
# the dict and no attempt is made to use a positional argument.
19741974

1975-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(dict, self='self')
1975+
wrapper = wrapt.PartialCallableObjectProxy(dict, self='self')
19761976

19771977
d = wrapper(arg1='arg1')
19781978

@@ -1989,7 +1989,7 @@ def __init__(self, *args, **kwargs):
19891989
self.assertEqual(o._args, ('arg1',))
19901990
self.assertEqual(o._kwargs, {})
19911991

1992-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, 'arg1')
1992+
wrapper = wrapt.PartialCallableObjectProxy(Object, 'arg1')
19931993

19941994
o = wrapper()
19951995

@@ -2007,7 +2007,7 @@ def __init__(self, *args, **kwargs):
20072007
self.assertEqual(o._args, ('arg1',))
20082008
self.assertEqual(o._kwargs, {})
20092009

2010-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object)
2010+
wrapper = wrapt.PartialCallableObjectProxy(Object)
20112011

20122012
o = wrapper('arg1')
20132013

@@ -2025,7 +2025,7 @@ def __init__(self, *args, **kwargs):
20252025

20262026
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
20272027

2028-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, self='self')
2028+
wrapper = wrapt.PartialCallableObjectProxy(Object, self='self')
20292029

20302030
with self.assertRaises(TypeError) as e:
20312031
o = wrapper()
@@ -2043,7 +2043,7 @@ def __init__(self, *args, **kwargs):
20432043

20442044
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
20452045

2046-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object)
2046+
wrapper = wrapt.PartialCallableObjectProxy(Object)
20472047

20482048
with self.assertRaises(TypeError) as e:
20492049
o = wrapper(self='self')
@@ -2061,7 +2061,7 @@ def __init__(self, *args, **kwargs):
20612061

20622062
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
20632063

2064-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, arg1='arg1', self='self')
2064+
wrapper = wrapt.PartialCallableObjectProxy(Object, arg1='arg1', self='self')
20652065

20662066
with self.assertRaises(TypeError) as e:
20672067
o = wrapper()
@@ -2079,7 +2079,7 @@ def __init__(self, *args, **kwargs):
20792079

20802080
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
20812081

2082-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object)
2082+
wrapper = wrapt.PartialCallableObjectProxy(Object)
20832083

20842084
with self.assertRaises(TypeError) as e:
20852085
o = wrapper(arg1='arg1', self='self')
@@ -2097,7 +2097,7 @@ def __init__(_self, *args, **kwargs):
20972097
self.assertEqual(o._args, ())
20982098
self.assertEqual(o._kwargs, dict(self="self"))
20992099

2100-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, self='self')
2100+
wrapper = wrapt.PartialCallableObjectProxy(Object, self='self')
21012101

21022102
o = wrapper()
21032103

@@ -2115,7 +2115,7 @@ def __init__(_self, *args, **kwargs):
21152115
self.assertEqual(o._args, ())
21162116
self.assertEqual(o._kwargs, dict(self="self"))
21172117

2118-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object)
2118+
wrapper = wrapt.PartialCallableObjectProxy(Object)
21192119

21202120
o = wrapper(self='self')
21212121

@@ -2135,7 +2135,7 @@ def __init__(_self, self, *args, **kwargs):
21352135
self.assertEqual(o._kwargs, {})
21362136
self.assertEqual(o._self, 'self')
21372137

2138-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, self='self')
2138+
wrapper = wrapt.PartialCallableObjectProxy(Object, self='self')
21392139

21402140
o = wrapper()
21412141

@@ -2156,7 +2156,7 @@ def __init__(_self, self, *args, **kwargs):
21562156
self.assertEqual(o._kwargs, {})
21572157
self.assertEqual(o._self, 'self')
21582158

2159-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object)
2159+
wrapper = wrapt.PartialCallableObjectProxy(Object)
21602160

21612161
o = wrapper(self='self')
21622162

@@ -2176,7 +2176,7 @@ def __init__(_self, self, *args, **kwargs):
21762176

21772177
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument '_self'.*", str(e.exception)), None)
21782178

2179-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object, _self='self')
2179+
wrapper = wrapt.PartialCallableObjectProxy(Object, _self='self')
21802180

21812181
with self.assertRaises(TypeError) as e:
21822182
o = wrapper()
@@ -2195,7 +2195,7 @@ def __init__(_self, self, *args, **kwargs):
21952195

21962196
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument '_self'.*", str(e.exception)), None)
21972197

2198-
wrapper = wrapt.wrappers.PartialCallableObjectProxy(Object)
2198+
wrapper = wrapt.PartialCallableObjectProxy(Object)
21992199

22002200
with self.assertRaises(TypeError) as e:
22012201
o = wrapper(_self='self')
@@ -2211,7 +2211,7 @@ def test_self_keyword_argument_on_dict(self):
22112211
def wrapper(wrapped, instance, args, kwargs):
22122212
return wrapped(*args, **kwargs)
22132213

2214-
d = wrapt.wrappers.FunctionWrapper(dict, wrapper)(self='self')
2214+
d = wrapt.FunctionWrapper(dict, wrapper)(self='self')
22152215

22162216
self.assertEqual(d, dict(self='self'))
22172217

@@ -2229,7 +2229,7 @@ def __init__(self, *args, **kwargs):
22292229
self.assertEqual(o._args, ('arg1',))
22302230
self.assertEqual(o._kwargs, {})
22312231

2232-
o = wrapt.wrappers.FunctionWrapper(Object, wrapper)('arg1')
2232+
o = wrapt.FunctionWrapper(Object, wrapper)('arg1')
22332233

22342234
self.assertEqual(o._args, ('arg1',))
22352235
self.assertEqual(o._kwargs, {})
@@ -2249,7 +2249,7 @@ def __init__(self, *args, **kwargs):
22492249
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
22502250

22512251
with self.assertRaises(TypeError) as e:
2252-
wrapt.wrappers.FunctionWrapper(Object, wrapper)(self='self')
2252+
wrapt.FunctionWrapper(Object, wrapper)(self='self')
22532253

22542254
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
22552255

@@ -2268,7 +2268,7 @@ def __init__(self, *args, **kwargs):
22682268
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
22692269

22702270
with self.assertRaises(TypeError) as e:
2271-
wrapt.wrappers.FunctionWrapper(Object, wrapper)(arg1='arg1', self='self')
2271+
wrapt.FunctionWrapper(Object, wrapper)(arg1='arg1', self='self')
22722272

22732273
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument 'self'.*", str(e.exception)), None)
22742274

@@ -2286,7 +2286,7 @@ def __init__(_self, *args, **kwargs):
22862286
self.assertEqual(o._args, ())
22872287
self.assertEqual(o._kwargs, dict(self="self"))
22882288

2289-
o = wrapt.wrappers.FunctionWrapper(Object, wrapper)(self='self')
2289+
o = wrapt.FunctionWrapper(Object, wrapper)(self='self')
22902290

22912291
self.assertEqual(o._args, ())
22922292
self.assertEqual(o._kwargs, dict(self="self"))
@@ -2307,7 +2307,7 @@ def __init__(_self, self, *args, **kwargs):
23072307
self.assertEqual(o._kwargs, {})
23082308
self.assertEqual(o._self, 'self')
23092309

2310-
o = wrapt.wrappers.FunctionWrapper(Object, wrapper)(self='self')
2310+
o = wrapt.FunctionWrapper(Object, wrapper)(self='self')
23112311

23122312
self.assertEqual(o._args, ())
23132313
self.assertEqual(o._kwargs, {})
@@ -2329,7 +2329,7 @@ def __init__(_self, self, *args, **kwargs):
23292329
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument '_self'.*", str(e.exception)), None)
23302330

23312331
with self.assertRaises(TypeError) as e:
2332-
wrapt.wrappers.FunctionWrapper(Object, wrapper)(_self='self')
2332+
wrapt.FunctionWrapper(Object, wrapper)(_self='self')
23332333

23342334
self.assertNotEqual(re.match(".*got multiple values for (keyword )?argument '_self'.*", str(e.exception)), None)
23352335

@@ -2344,7 +2344,7 @@ class Object:
23442344
def function(cls, self, *args, **kwargs):
23452345
return self, args, kwargs
23462346

2347-
function = wrapt.wrappers.FunctionWrapper(function, wrapper)
2347+
function = wrapt.FunctionWrapper(function, wrapper)
23482348

23492349
result = Object().function(self='self')
23502350

@@ -2358,7 +2358,7 @@ class Object:
23582358
def function(_self, self, *args, **kwargs):
23592359
return self, args, kwargs
23602360

2361-
function = wrapt.wrappers.FunctionWrapper(function, wrapper)
2361+
function = wrapt.FunctionWrapper(function, wrapper)
23622362

23632363
result = Object().function(self='self')
23642364

tests/test_weak_function_proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def test_self_keyword_argument(self):
196196
def function(self, *args, **kwargs):
197197
return self, args, kwargs
198198

199-
proxy = wrapt.wrappers.WeakFunctionProxy(function)
199+
proxy = wrapt.WeakFunctionProxy(function)
200200

201201
self.assertEqual(proxy(self='self', arg1='arg1'), ('self', (), dict(arg1='arg1')))
202202

0 commit comments

Comments
 (0)