"Fossies" - the Fresh Open Source Software Archive

Member "swig-4.1.1/Examples/test-suite/python/abstract_basecast_runme.py" (30 Nov 2022, 332 Bytes) of package /linux/misc/swig-4.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 from abstract_basecast import *
    2 
    3 def check(flag):
    4     if not flag:
    5         raise RuntimeError("Test failed")
    6 
    7 derived = DerivedClass()
    8 derived.g()
    9 check(isinstance(derived, BaseClass))
   10 check(isinstance(derived, DerivedClass))
   11 
   12 base = derived.f()
   13 base.g()
   14 check(isinstance(base, BaseClass))
   15 check(not isinstance(base, DerivedClass))