Skip to content

Commit 70615c2

Browse files
committed
Separate tests for python3.9 above
1 parent f57aa29 commit 70615c2

File tree

5 files changed

+148
-6
lines changed

5 files changed

+148
-6
lines changed

tests/functional/m/method_hidden.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ class Parent:
110110
def __init__(self):
111111
self._protected = None
112112
self._protected_two = None
113-
self._protected_three = None
114113

115114

116115
class Child(Parent):
@@ -127,10 +126,6 @@ def _protected(self):
127126
def _protected_two(self):
128127
pass
129128

130-
@functools().cached_property
131-
def _protected_three(self):
132-
pass
133-
134129

135130
class ParentTwo:
136131
def __init__(self):

tests/functional/m/method_hidden.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
method-hidden:20:4:20:12:Cdef.abcd:An attribute defined in functional.m.method_hidden line 14 hides this method:UNDEFINED
22
method-hidden:88:4:88:11:One.one:An attribute defined in functional.m.method_hidden line 86 hides this method:UNDEFINED
3-
method-hidden:117:4:117:18:Child._protected:An attribute defined in functional.m.method_hidden line 111 hides this method:UNDEFINED
3+
method-hidden:116:4:116:18:Child._protected:An attribute defined in functional.m.method_hidden line 111 hides this method:UNDEFINED
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# pylint: disable=too-few-public-methods,missing-docstring
2+
# pylint: disable=unused-private-member
3+
# pylint: disable=import-error
4+
"""check method hiding ancestor attribute
5+
"""
6+
import functools as ft
7+
import something_else as functools
8+
9+
10+
class Abcd:
11+
"""dummy"""
12+
13+
def __init__(self):
14+
self.abcd = 1
15+
16+
17+
class Cdef(Abcd):
18+
"""dummy"""
19+
20+
def abcd(self): # [method-hidden]
21+
"""test"""
22+
print(self)
23+
24+
25+
class AbcdMixin:
26+
def abcd(self):
27+
pass
28+
29+
30+
class Dabc(AbcdMixin, Abcd):
31+
def abcd(self):
32+
pass
33+
34+
35+
class CustomProperty:
36+
"""dummy"""
37+
38+
def __init__(self, _):
39+
pass
40+
41+
def __get__(self, obj, __):
42+
if not obj:
43+
return self
44+
return 5
45+
46+
def __set__(self, _, __):
47+
pass
48+
49+
50+
class Ddef:
51+
"""dummy"""
52+
53+
def __init__(self):
54+
self.five = "five"
55+
56+
@CustomProperty
57+
def five(self):
58+
"""Always 5."""
59+
return self
60+
61+
62+
def my_decorator(*args, **kwargs):
63+
return CustomProperty(*args, **kwargs)
64+
65+
66+
class Foo:
67+
def __init__(self):
68+
self._bar = 42
69+
self._baz = 84
70+
71+
@my_decorator
72+
def method(self): # E0202
73+
return self._baz
74+
75+
@method.setter
76+
def method(self, value):
77+
self._baz = value
78+
79+
def do_something_with_baz(self, value):
80+
self.method = value
81+
82+
83+
class One:
84+
def __init__(self, one=None):
85+
if one is not None:
86+
self.one = one
87+
88+
def one(self): # [method-hidden]
89+
pass
90+
91+
92+
class Two(One):
93+
def one(self):
94+
pass
95+
96+
97+
try:
98+
import unknown as js
99+
except ImportError:
100+
import json as js
101+
102+
103+
class JsonEncoder(js.JSONEncoder):
104+
# pylint: disable=useless-super-delegation,super-with-arguments
105+
def default(self, o):
106+
return super(JsonEncoder, self).default(o)
107+
108+
109+
class Parent:
110+
def __init__(self):
111+
self._protected = None
112+
self._protected_two = None
113+
self._protected_three = None
114+
115+
116+
class Child(Parent):
117+
def _protected(self): # [method-hidden]
118+
pass
119+
120+
121+
class CachedChild(Parent):
122+
@ft.cached_property
123+
def _protected(self):
124+
pass
125+
126+
@functools.cached_property
127+
def _protected_two(self):
128+
pass
129+
130+
@functools().cached_property
131+
def _protected_three(self):
132+
pass
133+
134+
135+
class ParentTwo:
136+
def __init__(self):
137+
self.__private = None
138+
139+
140+
class ChildTwo(ParentTwo):
141+
def __private(self):
142+
pass
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[testoptions]
2+
min_pyver = 3.9
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
method-hidden:20:4:20:12:Cdef.abcd:An attribute defined in functional.m.method_hidden_py39 line 14 hides this method:UNDEFINED
2+
method-hidden:88:4:88:11:One.one:An attribute defined in functional.m.method_hidden_py39 line 86 hides this method:UNDEFINED
3+
method-hidden:117:4:117:18:Child._protected:An attribute defined in functional.m.method_hidden_py39 line 111 hides this method:UNDEFINED

0 commit comments

Comments
 (0)