From c2248cad2760602724e5858fb93299c4ee966825 Mon Sep 17 00:00:00 2001 From: Andy Mikhaylenko Date: Thu, 2 Jan 2014 23:56:40 +0600 Subject: [PATCH] Add test for decorating a method (re #51) --- test/test_decorators.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_decorators.py b/test/test_decorators.py index 4ed641a..d169d4c 100644 --- a/test/test_decorators.py +++ b/test/test_decorators.py @@ -37,6 +37,15 @@ def func(): assert attr == 'new-name' +def test_named_method(): + class A: + @argh.named('new-name') + def meth(self): + pass + assert getattr(A.meth, argh.constants.ATTR_NAME) == 'new-name' + assert getattr(A().meth, argh.constants.ATTR_NAME) == 'new-name' + + def test_command(): @argh.command def func():