File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1980,6 +1980,51 @@ def test_disallowed_grouping__no_matching_bracket(self):
19801980 err = "Function 'empty_group' has a ']' without a matching '['"
19811981 self .expect_failure (block , err )
19821982
1983+ def test_disallowed_grouping__parameter_after_group (self ):
1984+ # Only positional-only parameters can follow an optional group.
1985+ group_err = ("You cannot use optional groups ('[' and ']') unless all "
1986+ "parameters are positional-only ('/')" )
1987+ kwds_err = ("Function 'bar' uses a var-keyword parameter and other "
1988+ "non-positional parameters, which Argument Clinic does "
1989+ "not currently support: '**kwds: dict'" )
1990+ dataset = (("""
1991+ module foo
1992+ foo.bar
1993+ [
1994+ a: int
1995+ b: int
1996+ ]
1997+ y: int
1998+ """ , group_err ), ("""
1999+ module foo
2000+ foo.bar
2001+ [
2002+ a: int
2003+ b: int
2004+ ]
2005+ *
2006+ y: int
2007+ """ , group_err ), ("""
2008+ module foo
2009+ foo.bar
2010+ [
2011+ a: int
2012+ b: int
2013+ ]
2014+ *args: tuple
2015+ """ , group_err ), ("""
2016+ module foo
2017+ foo.bar
2018+ [
2019+ a: int
2020+ b: int
2021+ ]
2022+ **kwds: dict
2023+ """ , kwds_err ))
2024+ for block , err in dataset :
2025+ with self .subTest (block = block ):
2026+ self .expect_failure (block , err )
2027+
19832028 def test_disallowed_grouping__must_be_position_only (self ):
19842029 dataset = ("""
19852030 with_kwds
You can’t perform that action at this time.
0 commit comments