Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
|
|||
from testing_helpers import wrap | |||
|
|||
@wrap | |||
def construct_and_get_fields(a,b): | |||
class A(object): | |||
def __init__(self, a): | |||
self.a = a | |||
class B(A): | |||
def __init__(self, a, b): | |||
A.__init__(self, a) | |||
self.b = b | |||
obj = A(a) | |||
obj2 = B(a,b) | |||
return obj.a, obj2.a, obj2.b | |||
|
|||
def test_nested_objects(): | |||
(a1, a2, a3) = construct_and_get_fields(1,2.0) | |||
assert a1 == 1 | |||
assert a2 == 1 | |||
assert a3 == 2.0 | |||
|
|||
|
|||
if __name__ == '__main__': | |||
test_nested_objects() |