Skip to content

Commit

Permalink
Add failing test for decorators on constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeLeclerc committed May 14, 2021
1 parent 90f0e8f commit 58af367
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,24 @@ def compute(p1, p2):

self.assertEqual(compute(), 111)

def test_class_constructor(self):
Section('sec1').params(
p1=Param(int),
)

class TestClass:

@param('sec1.p1', 'value')
def __init__(self, value):
self.value = value

get_current_config().collect({
'sec1.p1': 42,
})

self.assertEqual(TestClass().value, 42)


def test_do_not_complain_not_missing_args(self):
@param('sec1.p1')
def compute(p1):
Expand Down

0 comments on commit 58af367

Please sign in to comment.