Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agroszer committed Jul 25, 2020
1 parent 3327528 commit 01118ee
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/samples/interface_inheritance.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class ISuperSomething(ISomething):
def greet(msg: str) -> None:
pass

class ISomethingSomething(ISuperSomething):
def wink(msg: str) -> None:
pass

@zope.interface.implementer(ISuperSomething)
class SuperSomething(object):
Expand All @@ -20,12 +23,15 @@ def hello(self, x: int, y: str) -> None:
def greet(self, msg) -> None:
print(f"Greetings, {msg}")

@zope.interface.implementer(ISomethingSomething)
class SomethingSomething(SuperSomething):
def wink(self, msg) -> None:
print(f"{msg} <wink>")

def run(smth: ISomething):
smth.hello(1, "test")



def greet(smth: ISuperSomething):
smth.hello(2, "test 2")
smth.greet("world")
Expand All @@ -35,6 +41,13 @@ def main() -> None:
smth = SuperSomething()
run(smth)

smthsmth = SomethingSomething()
smthsmth.greet("bob")
smthsmth.wink("susanne")
smthsmth.hello(1, "dude")

run(smthsmth)


if __name__ == '__main__':
main()
Expand Down

0 comments on commit 01118ee

Please sign in to comment.