Exemplo n.º 1
0
 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"
Exemplo n.º 2
0
 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"
Exemplo n.º 3
0
 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"
Exemplo n.º 4
0
 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"
Exemplo n.º 5
0
 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"
Exemplo n.º 6
0
 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"
Exemplo n.º 7
0
    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'"
Exemplo n.º 8
0
 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')
Exemplo n.º 9
0
 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'"
Exemplo n.º 10
0
    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'"