return '%s(%s)' % (type_name, ', '.join(arg_strings))
def _get_kwargs(self):
- return sorted(self.__dict__.items())
+ return list(self.__dict__.items())
def _get_args(self):
return []
def test_namespace(self):
ns = argparse.Namespace(foo=42, bar='spam')
- string = "Namespace(bar='spam', foo=42)"
+ string = "Namespace(foo=42, bar='spam')"
self.assertStringEqual(ns, string)
def test_namespace_starkwargs_notidentifier(self):
--- /dev/null
+In the argparse module, the repr for Namespace() and other argument holders
+now displayed in the order attributes were added. Formerly, it displayed in
+alphabetical order even though argument order is preserved the user visible
+parts of the module.