fork download
  1. class ParentClass:
  2. def __init__(self, *, x, y):
  3. self.x = x
  4. self.y = y
  5.  
  6. class DerivedClass(ParentClass):
  7. def __init__(self, *args, **kargs):
  8. print("Doing some extra work...")
  9. super().__init__(*args, **kargs)
  10.  
  11. def actuallyAssert(expr):
  12. if not expr:
  13. raise Exception("Assert failed!")
  14.  
  15. obj = DerivedClass(x=23, y=42)
  16. actuallyAssert(obj.x == 23)
  17. actuallyAssert(obj.y == 42)
  18. print("If you can read this, it worked")
Success #stdin #stdout 0.01s 27704KB
stdin
Standard input is empty
stdout
Doing some extra work...
If you can read this, it worked