getgroup can also create groups now

--HG--
branch : trunk
This commit is contained in:
holger krekel
2009-04-13 12:33:01 +02:00
parent ef63510f42
commit 5c854bea30
2 changed files with 11 additions and 3 deletions

View File

@@ -18,7 +18,15 @@ class TestParser:
py.test.raises(ValueError, parser.addgroup, "hello")
group2 = parser.getgroup("hello")
assert group2 is group
py.test.raises(ValueError, parser.getgroup, 'something')
def test_getgroup_addsgroup(self):
parser = parseopt.Parser()
group = parser.getgroup("hello", description="desc")
assert group.name == "hello"
assert group.description == "desc"
group2 = parser.getgroup("hello")
assert group2 is group
def test_group_addoption(self):
group = parseopt.OptionGroup("hello")