def test_unknown_keywords(self): err = ArgErrUnknownKwds(1, ['a', 'b'], [True, False]) s = err.getmsg('foo') assert s == "foo() got an unexpected keyword argument 'b'" err = ArgErrUnknownKwds(2, ['a', 'b', 'c'], [True, False, False]) s = err.getmsg('foo') assert s == "foo() got 2 unexpected keyword arguments"
def test_unknown_keywords(self): space = DummySpace() err = ArgErrUnknownKwds(space, 1, ["a", "b"], [True, False], None) s = err.getmsg() assert s == "got an unexpected keyword argument 'b'" err = ArgErrUnknownKwds(space, 2, ["a", "b", "c"], [True, False, False], None) s = err.getmsg() assert s == "got 2 unexpected keyword arguments"
def test_unknown_keywords(self): space = DummySpace() err = ArgErrUnknownKwds(space, 1, ['a', 'b'], [True, False], None) s = err.getmsg('foo') assert s == "foo() got an unexpected keyword argument 'b'" err = ArgErrUnknownKwds(space, 2, ['a', 'b', 'c'], [True, False, False], None) s = err.getmsg('foo') assert s == "foo() got 2 unexpected keyword arguments"
def test_unknown_unicode_keyword(self): class DummySpaceUnicode(DummySpace): class sys: defaultencoding = 'utf-8' space = DummySpaceUnicode() err = ArgErrUnknownKwds(space, 1, ['a', None, 'b', 'c'], [0, 3, 2], [unichr(0x1234), u'b', u'c']) s = err.getmsg() assert s == "got an unexpected keyword argument '\xe1\x88\xb4'"
def test_unknown_unicode_keyword(self): class DummySpaceUnicode(DummySpace): class sys: defaultencoding = 'utf-8' space = DummySpaceUnicode() err = ArgErrUnknownKwds(space, 1, ['a', None, 'b', 'c'], [0, 3, 2], [unichr(0x1234), u'b', u'c']) s = err.getmsg() assert s == "got an unexpected keyword argument '%s'" % unichr(0x1234).encode('utf-8')
def test_unknown_unicode_keyword(self): class DummySpaceUnicode(DummySpace): class sys: defaultencoding = 'utf-8' space = DummySpaceUnicode() err = ArgErrUnknownKwds(space, 1, ['a', None, 'b', 'c'], [True, False, True, True], [unichr(0x1234), u'b', u'c']) s = err.getmsg('foo') assert s == "foo() got an unexpected keyword argument '\xe1\x88\xb4'"
def test_unknown_unicode_keyword(self): class DummySpaceUnicode(DummySpace): class sys: defaultencoding = "utf-8" space = DummySpaceUnicode() err = ArgErrUnknownKwds( space, 1, ["a", None, "b", "c"], [True, False, True, True], [unichr(0x1234), u"b", u"c"] ) s = err.getmsg() assert s == "got an unexpected keyword argument '\xe1\x88\xb4'"
def test_unknown_keywords(self): space = DummySpace() err = ArgErrUnknownKwds(space, 1, ['a', 'b'], [0], None) s = err.getmsg() assert s == "got an unexpected keyword argument 'b'" err = ArgErrUnknownKwds(space, 1, ['a', 'b'], [1], None) s = err.getmsg() assert s == "got an unexpected keyword argument 'a'" err = ArgErrUnknownKwds(space, 2, ['a', 'b', 'c'], [0], None) s = err.getmsg() assert s == "got 2 unexpected keyword arguments"