Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b0b0c3

Browse files
committed
Python: Cleanup overrides tests
1 parent 92e272c commit 9b0b0c3

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
| test.py:3:5:3:20 | Function Wat.upper | overriding | not overridden |
2-
| test.py:6:1:6:26 | Function outside_func | not overriding | overridden |
3-
| test.py:11:11:11:29 | Function Base.lambda | not overriding | overridden |
4-
| test.py:13:24:13:36 | Function Base.lambda | not overriding | not overridden |
5-
| test.py:17:5:17:21 | Function Base.normal | not overriding | overridden |
6-
| test.py:28:5:28:21 | Function Sub2.foo | overriding | overridden |
7-
| test.py:31:5:31:24 | Function Sub2.tricky | overriding | not overridden |
8-
| test.py:36:5:36:21 | Function Sub2Sub.foo | overriding | not overridden |
9-
| test.py:39:5:39:18 | Function Sub2Sub.baz | overriding | not overridden |
1+
| test.py:3:5:3:20 | Function MyStr.upper | overriding | not overridden |
2+
| test.py:11:1:11:26 | Function outside_func | not overriding | overridden |
3+
| test.py:16:11:16:29 | Function Base.lambda | not overriding | overridden |
4+
| test.py:18:24:18:36 | Function Base.lambda | not overriding | not overridden |
5+
| test.py:22:5:22:21 | Function Base.normal | not overriding | overridden |
6+
| test.py:33:5:33:21 | Function Bar.foo | overriding | overridden |
7+
| test.py:36:5:36:24 | Function Bar.tricky | overriding | not overridden |
8+
| test.py:41:5:41:21 | Function SpecialBar.foo | overriding | not overridden |
9+
| test.py:44:5:44:18 | Function SpecialBar.baz | overriding | not overridden |
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
class Wat(str):
1+
class MyStr(str):
22

33
def upper(self):
44
return self.lower()
55

6+
7+
s = MyStr('asdf')
8+
print(s.upper(), len(s))
9+
10+
611
def outside_func(self, x):
712
print(x)
813

@@ -19,35 +24,31 @@ def normal(self):
1924

2025
tricky = outside_func
2126

22-
class Sub(Base):
27+
class Foo(Base):
2328

2429
normal = False
2530

26-
class Sub2(Base):
31+
class Bar(Base):
2732

2833
def foo(self, y):
2934
return y * 100
3035

3136
def tricky(self, x):
32-
print('nice!', x)
37+
print('tricky!', x)
3338

34-
class Sub2Sub(Sub2):
39+
class SpecialBar(Bar):
3540

3641
def foo(self, z):
3742
return z / 123
3843

3944
def baz(self):
40-
print('python is a bit crazy sometimes')
45+
print('baz')
4146

4247

43-
ws = Wat('asdf')
44-
print(ws.upper(), len(ws))
45-
4648
b = Base()
4749
print(b.foo(1))
4850
print(b.bar(10))
4951

50-
51-
ss = SubSub()
52-
print(ss.foo(1))
53-
ss.baz()
52+
sb = SpecialBar()
53+
print(sb.foo(1))
54+
sb.baz()

0 commit comments

Comments
 (0)