コード例 #1
0
ファイル: test_argument.py プロジェクト: alkorzt/pypy
 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"
コード例 #2
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"
コード例 #3
0
ファイル: test_argument.py プロジェクト: gorakhargosh/pypy
 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"
コード例 #4
0
ファイル: test_argument.py プロジェクト: sota/pypy-old
    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'"
コード例 #5
0
ファイル: test_argument.py プロジェクト: Qointum/pypy
 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')
コード例 #6
0
ファイル: test_argument.py プロジェクト: gorakhargosh/pypy
 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'"
コード例 #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"], [True, False, True, True], [unichr(0x1234), u"b", u"c"]
        )
        s = err.getmsg()
        assert s == "got an unexpected keyword argument '\xe1\x88\xb4'"
コード例 #8
0
ファイル: test_argument.py プロジェクト: sota/pypy-old
 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"
コード例 #9
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"
コード例 #10
0
ファイル: test_argument.py プロジェクト: Qointum/pypy
 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"