Created
July 6, 2012 00:32
-
-
Save emberian/3057314 to your computer and use it in GitHub Desktop.
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
class Part(object): | |
inside = False | |
class Object(list): | |
def __init__(self): | |
self[0] = Part() | |
self[1] = Part() | |
def object_inside(o): | |
return all(part.inside == True for part in o) | |
def test_inside(): | |
o = Object() | |
for part in o: | |
part.inside = True | |
assert True == object_inside(o) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment