Commit 3c6938d2 authored by Martin v. Löwis's avatar Martin v. Löwis

Ran svneol.py

parent b303fef4
import unittest, os, errno import unittest, os, errno
from ctypes import * from ctypes import *
from ctypes.util import find_library from ctypes.util import find_library
import threading import threading
class Test(unittest.TestCase): class Test(unittest.TestCase):
def test_open(self): def test_open(self):
libc_name = find_library("c") libc_name = find_library("c")
if libc_name is not None: if libc_name is not None:
libc = CDLL(libc_name, use_errno=True) libc = CDLL(libc_name, use_errno=True)
if os.name == "nt": if os.name == "nt":
libc_open = libc._open libc_open = libc._open
else: else:
libc_open = libc.open libc_open = libc.open
libc_open.argtypes = c_char_p, c_int libc_open.argtypes = c_char_p, c_int
self.failUnlessEqual(libc_open("", 0), -1) self.failUnlessEqual(libc_open("", 0), -1)
self.failUnlessEqual(get_errno(), errno.ENOENT) self.failUnlessEqual(get_errno(), errno.ENOENT)
self.failUnlessEqual(set_errno(32), errno.ENOENT) self.failUnlessEqual(set_errno(32), errno.ENOENT)
self.failUnlessEqual(get_errno(), 32) self.failUnlessEqual(get_errno(), 32)
def _worker(): def _worker():
set_errno(0) set_errno(0)
libc = CDLL(libc_name, use_errno=False) libc = CDLL(libc_name, use_errno=False)
if os.name == "nt": if os.name == "nt":
libc_open = libc._open libc_open = libc._open
else: else:
libc_open = libc.open libc_open = libc.open
libc_open.argtypes = c_char_p, c_int libc_open.argtypes = c_char_p, c_int
self.failUnlessEqual(libc_open("", 0), -1) self.failUnlessEqual(libc_open("", 0), -1)
self.failUnlessEqual(get_errno(), 0) self.failUnlessEqual(get_errno(), 0)
t = threading.Thread(target=_worker) t = threading.Thread(target=_worker)
t.start() t.start()
t.join() t.join()
self.failUnlessEqual(get_errno(), 32) self.failUnlessEqual(get_errno(), 32)
set_errno(0) set_errno(0)
if os.name == "nt": if os.name == "nt":
def test_GetLastError(self): def test_GetLastError(self):
dll = WinDLL("kernel32", use_last_error=True) dll = WinDLL("kernel32", use_last_error=True)
GetModuleHandle = dll.GetModuleHandleA GetModuleHandle = dll.GetModuleHandleA
GetModuleHandle.argtypes = [c_wchar_p] GetModuleHandle.argtypes = [c_wchar_p]
self.failUnlessEqual(0, GetModuleHandle("foo")) self.failUnlessEqual(0, GetModuleHandle("foo"))
self.failUnlessEqual(get_last_error(), 126) self.failUnlessEqual(get_last_error(), 126)
self.failUnlessEqual(set_last_error(32), 126) self.failUnlessEqual(set_last_error(32), 126)
self.failUnlessEqual(get_last_error(), 32) self.failUnlessEqual(get_last_error(), 32)
def _worker(): def _worker():
set_last_error(0) set_last_error(0)
dll = WinDLL("kernel32", use_last_error=False) dll = WinDLL("kernel32", use_last_error=False)
GetModuleHandle = dll.GetModuleHandleW GetModuleHandle = dll.GetModuleHandleW
GetModuleHandle.argtypes = [c_wchar_p] GetModuleHandle.argtypes = [c_wchar_p]
GetModuleHandle("bar") GetModuleHandle("bar")
self.failUnlessEqual(get_last_error(), 0) self.failUnlessEqual(get_last_error(), 0)
t = threading.Thread(target=_worker) t = threading.Thread(target=_worker)
t.start() t.start()
t.join() t.join()
self.failUnlessEqual(get_last_error(), 32) self.failUnlessEqual(get_last_error(), 32)
set_last_error(0) set_last_error(0)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
Received: from xcar [192.168.0.2] by jeeves.wooster.local Received: from xcar [192.168.0.2] by jeeves.wooster.local
(SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100
Date: Sun, 12 May 2002 08:56:15 +0100 Date: Sun, 12 May 2002 08:56:15 +0100
From: Father Time <father.time@xcar.wooster.local> From: Father Time <father.time@xcar.wooster.local>
To: timbo@jeeves.wooster.local To: timbo@jeeves.wooster.local
Subject: IMAP file test Subject: IMAP file test
Message-ID: <6df65d354b.father.time@rpc.wooster.local> Message-ID: <6df65d354b.father.time@rpc.wooster.local>
X-Organization: Home X-Organization: Home
User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680"
Status: R Status: R
X-UIDL: 319998302 X-UIDL: 319998302
This message is in MIME format which your mailer apparently does not support. This message is in MIME format which your mailer apparently does not support.
You either require a newer version of your software which supports MIME, or You either require a newer version of your software which supports MIME, or
a separate MIME decoding utility. Alternatively, ask the sender of this a separate MIME decoding utility. Alternatively, ask the sender of this
message to resend it in a different format. message to resend it in a different format.
--1618492860--2051301190--113853680 --1618492860--2051301190--113853680
Content-Type: text/plain; charset=us-ascii Content-Type: text/plain; charset=us-ascii
Simple email with attachment. Simple email with attachment.
--1618492860--2051301190--113853680 --1618492860--2051301190--113853680
Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03
Content-Disposition: attachment; filename="clock.bmp" Content-Disposition: attachment; filename="clock.bmp"
Content-Transfer-Encoding: base64 Content-Transfer-Encoding: base64
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA
AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A
zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA
C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/
f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3////
////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// ////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B/////
8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA 8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA
AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA
sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0
z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA
AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH
MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA
AAAAAAAIAAAAAAAAAIAAAAAA AAAAAAAIAAAAAAAAAIAAAAAA
--1618492860--2051301190--113853680-- --1618492860--2051301190--113853680--
# -*- coding: latin1 -*- # -*- coding: latin1 -*-
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' # IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf'
# at the start of it. Make sure this is preserved if any changes # at the start of it. Make sure this is preserved if any changes
# are made! Also note that the coding cookie above conflicts with # are made! Also note that the coding cookie above conflicts with
# the presense of a utf-8 BOM signature -- this is intended. # the presense of a utf-8 BOM signature -- this is intended.
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). # Arbitrary encoded utf-8 text (stolen from test_doctest2.py).
x = 'ЉЊЈЁЂ' x = 'ЉЊЈЁЂ'
def y(): def y():
""" """
And again in a comment. ЉЊЈЁЂ And again in a comment. ЉЊЈЁЂ
""" """
pass pass
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' # IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf'
# at the start of it. Make sure this is preserved if any changes # at the start of it. Make sure this is preserved if any changes
# are made! # are made!
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). # Arbitrary encoded utf-8 text (stolen from test_doctest2.py).
x = 'ЉЊЈЁЂ' x = 'ЉЊЈЁЂ'
def y(): def y():
""" """
And again in a comment. ЉЊЈЁЂ And again in a comment. ЉЊЈЁЂ
""" """
pass pass
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# IMPORTANT: unlike the other test_tokenize-*.txt files, this file # IMPORTANT: unlike the other test_tokenize-*.txt files, this file
# does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start # does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start
# of it. Make sure this is not added inadvertently by your editor # of it. Make sure this is not added inadvertently by your editor
# if any changes are made to this file! # if any changes are made to this file!
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). # Arbitrary encoded utf-8 text (stolen from test_doctest2.py).
x = 'ЉЊЈЁЂ' x = 'ЉЊЈЁЂ'
def y(): def y():
""" """
And again in a comment. ЉЊЈЁЂ And again in a comment. ЉЊЈЁЂ
""" """
pass pass
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' # IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf'
# at the start of it. Make sure this is preserved if any changes # at the start of it. Make sure this is preserved if any changes
# are made! # are made!
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). # Arbitrary encoded utf-8 text (stolen from test_doctest2.py).
x = 'ЉЊЈЁЂ' x = 'ЉЊЈЁЂ'
def y(): def y():
""" """
And again in a comment. ЉЊЈЁЂ And again in a comment. ЉЊЈЁЂ
""" """
pass pass
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment