Show More
@@ -77,44 +77,44 b' def foo(self, args):' | |||||
77 | @parametric |
|
77 | @parametric | |
78 | def test_magic_arguments(): |
|
78 | def test_magic_arguments(): | |
79 | # Ideally, these would be doctests, but I could not get it to work. |
|
79 | # Ideally, these would be doctests, but I could not get it to work. | |
80 | yield assert_equal(magic_foo1.__doc__, '%foo1 [-f FOO]\n\nA docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
80 | yield assert_equal(magic_foo1.__doc__, '%foo1 [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
81 | yield assert_equal(getattr(magic_foo1, 'argcmd_name', None), None) |
|
81 | yield assert_equal(getattr(magic_foo1, 'argcmd_name', None), None) | |
82 | yield assert_equal(real_name(magic_foo1), 'foo1') |
|
82 | yield assert_equal(real_name(magic_foo1), 'foo1') | |
83 | yield assert_equal(magic_foo1(None, ''), argparse.Namespace(foo=None)) |
|
83 | yield assert_equal(magic_foo1(None, ''), argparse.Namespace(foo=None)) | |
84 | yield assert_true(hasattr(magic_foo1, 'has_arguments')) |
|
84 | yield assert_true(hasattr(magic_foo1, 'has_arguments')) | |
85 |
|
85 | |||
86 | yield assert_equal(magic_foo2.__doc__, '%foo2\n\nA docstring.\n') |
|
86 | yield assert_equal(magic_foo2.__doc__, '%foo2\n\n A docstring.\n') | |
87 | yield assert_equal(getattr(magic_foo2, 'argcmd_name', None), None) |
|
87 | yield assert_equal(getattr(magic_foo2, 'argcmd_name', None), None) | |
88 | yield assert_equal(real_name(magic_foo2), 'foo2') |
|
88 | yield assert_equal(real_name(magic_foo2), 'foo2') | |
89 | yield assert_equal(magic_foo2(None, ''), argparse.Namespace()) |
|
89 | yield assert_equal(magic_foo2(None, ''), argparse.Namespace()) | |
90 | yield assert_true(hasattr(magic_foo2, 'has_arguments')) |
|
90 | yield assert_true(hasattr(magic_foo2, 'has_arguments')) | |
91 |
|
91 | |||
92 | yield assert_equal(magic_foo3.__doc__, '%foo3 [-f FOO] [-b BAR] [-z BAZ]\n\nA docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n\nGroup:\n -b BAR, --bar BAR a grouped argument\n\nSecond Group:\n -z BAZ, --baz BAZ another grouped argument\n') |
|
92 | yield assert_equal(magic_foo3.__doc__, '%foo3 [-f FOO] [-b BAR] [-z BAZ]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n\nGroup:\n -b BAR, --bar BAR a grouped argument\n\nSecond Group:\n -z BAZ, --baz BAZ another grouped argument\n') | |
93 | yield assert_equal(getattr(magic_foo3, 'argcmd_name', None), None) |
|
93 | yield assert_equal(getattr(magic_foo3, 'argcmd_name', None), None) | |
94 | yield assert_equal(real_name(magic_foo3), 'foo3') |
|
94 | yield assert_equal(real_name(magic_foo3), 'foo3') | |
95 | yield assert_equal(magic_foo3(None, ''), |
|
95 | yield assert_equal(magic_foo3(None, ''), | |
96 | argparse.Namespace(bar=None, baz=None, foo=None)) |
|
96 | argparse.Namespace(bar=None, baz=None, foo=None)) | |
97 | yield assert_true(hasattr(magic_foo3, 'has_arguments')) |
|
97 | yield assert_true(hasattr(magic_foo3, 'has_arguments')) | |
98 |
|
98 | |||
99 | yield assert_equal(magic_foo4.__doc__, '%foo4 [-f FOO]\n\nA docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
99 | yield assert_equal(magic_foo4.__doc__, '%foo4 [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
100 | yield assert_equal(getattr(magic_foo4, 'argcmd_name', None), None) |
|
100 | yield assert_equal(getattr(magic_foo4, 'argcmd_name', None), None) | |
101 | yield assert_equal(real_name(magic_foo4), 'foo4') |
|
101 | yield assert_equal(real_name(magic_foo4), 'foo4') | |
102 | yield assert_equal(magic_foo4(None, ''), argparse.Namespace()) |
|
102 | yield assert_equal(magic_foo4(None, ''), argparse.Namespace()) | |
103 | yield assert_true(hasattr(magic_foo4, 'has_arguments')) |
|
103 | yield assert_true(hasattr(magic_foo4, 'has_arguments')) | |
104 |
|
104 | |||
105 | yield assert_equal(magic_foo5.__doc__, '%frobnicate [-f FOO]\n\nA docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
105 | yield assert_equal(magic_foo5.__doc__, '%frobnicate [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
106 | yield assert_equal(getattr(magic_foo5, 'argcmd_name', None), 'frobnicate') |
|
106 | yield assert_equal(getattr(magic_foo5, 'argcmd_name', None), 'frobnicate') | |
107 | yield assert_equal(real_name(magic_foo5), 'frobnicate') |
|
107 | yield assert_equal(real_name(magic_foo5), 'frobnicate') | |
108 | yield assert_equal(magic_foo5(None, ''), argparse.Namespace(foo=None)) |
|
108 | yield assert_equal(magic_foo5(None, ''), argparse.Namespace(foo=None)) | |
109 | yield assert_true(hasattr(magic_foo5, 'has_arguments')) |
|
109 | yield assert_true(hasattr(magic_foo5, 'has_arguments')) | |
110 |
|
110 | |||
111 | yield assert_equal(magic_magic_foo.__doc__, '%magic_foo [-f FOO]\n\nA docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
111 | yield assert_equal(magic_magic_foo.__doc__, '%magic_foo [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
112 | yield assert_equal(getattr(magic_magic_foo, 'argcmd_name', None), None) |
|
112 | yield assert_equal(getattr(magic_magic_foo, 'argcmd_name', None), None) | |
113 | yield assert_equal(real_name(magic_magic_foo), 'magic_foo') |
|
113 | yield assert_equal(real_name(magic_magic_foo), 'magic_foo') | |
114 | yield assert_equal(magic_magic_foo(None, ''), argparse.Namespace(foo=None)) |
|
114 | yield assert_equal(magic_magic_foo(None, ''), argparse.Namespace(foo=None)) | |
115 | yield assert_true(hasattr(magic_magic_foo, 'has_arguments')) |
|
115 | yield assert_true(hasattr(magic_magic_foo, 'has_arguments')) | |
116 |
|
116 | |||
117 | yield assert_equal(foo.__doc__, '%foo [-f FOO]\n\nA docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
117 | yield assert_equal(foo.__doc__, '%foo [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
118 | yield assert_equal(getattr(foo, 'argcmd_name', None), None) |
|
118 | yield assert_equal(getattr(foo, 'argcmd_name', None), None) | |
119 | yield assert_equal(real_name(foo), 'foo') |
|
119 | yield assert_equal(real_name(foo), 'foo') | |
120 | yield assert_equal(foo(None, ''), argparse.Namespace(foo=None)) |
|
120 | yield assert_equal(foo(None, ''), argparse.Namespace(foo=None)) |
General Comments 0
You need to be logged in to leave comments.
Login now