Skip to content

Commit

Permalink
Added test for class methods see https://stackoverflow.com/questions/…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain MARIE committed Mar 22, 2020
1 parent 52c924a commit 7d4d311
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions makefun/tests/test_compile_deco.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@ def bar(a, b):

assert bar(5, -5.0) == 0


def test_compilefun_method():
"""Tests that the @compilefun decorator works for class methods"""

class A:
@compile_fun
def meth1(self, par1):
print("in A.meth1: par1 =", par1)

a = A()
a.meth1("via meth1")

class A:
def __init__(self):
self.i = 1

@compile_fun
def add(self, a):
return self.i + a

a = A()
assert A().add(-1) == 0


# def test_compileclass_decorator():
#
# @compile_fun
Expand Down

0 comments on commit 7d4d311

Please sign in to comment.