diff options
author | Christian Heimes <christian@cheimes.de> | 2008-02-23 18:30:17 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-02-23 18:30:17 (GMT) |
commit | 05e8be17fd15d8e649e026600f5ab20e1154599f (patch) | |
tree | aecf3cd024e9cf2ed2ae49087b6c74dba29c7c7e /Lib/test | |
parent | 5abe9125f9eb858fdaca966d687bb32387603f45 (diff) | |
download | cpython-05e8be17fd15d8e649e026600f5ab20e1154599f.zip cpython-05e8be17fd15d8e649e026600f5ab20e1154599f.tar.gz cpython-05e8be17fd15d8e649e026600f5ab20e1154599f.tar.bz2 |
Merged revisions 60990-61002 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60990 | eric.smith | 2008-02-23 17:05:26 +0100 (Sat, 23 Feb 2008) | 1 line
Removed duplicate Py_CHARMASK define. It's already defined in Python.h.
........
r60991 | andrew.kuchling | 2008-02-23 17:23:05 +0100 (Sat, 23 Feb 2008) | 4 lines
#1330538: Improve comparison of xmlrpclib.DateTime and datetime instances.
Remove automatic handling of datetime.date and datetime.time.
This breaks backward compatibility, but python-dev discussion was strongly
against this automatic conversion; see the bug for a link.
........
r60994 | andrew.kuchling | 2008-02-23 17:39:43 +0100 (Sat, 23 Feb 2008) | 1 line
#835521: Add index entries for various pickle-protocol methods and attributes
........
r60995 | andrew.kuchling | 2008-02-23 18:10:46 +0100 (Sat, 23 Feb 2008) | 2 lines
#1433694: minidom's .normalize() failed to set .nextSibling for last element.
Fix by Malte Helmert
........
r61000 | christian.heimes | 2008-02-23 18:40:11 +0100 (Sat, 23 Feb 2008) | 1 line
Patch #2167 from calvin: Remove unused imports
........
r61001 | christian.heimes | 2008-02-23 18:42:31 +0100 (Sat, 23 Feb 2008) | 1 line
Patch #1957: syslogmodule: Release GIL when calling syslog(3)
........
r61002 | christian.heimes | 2008-02-23 18:52:07 +0100 (Sat, 23 Feb 2008) | 2 lines
Issue #2051 and patch from Alexander Belopolsky:
Permission for pyc and pyo files are inherited from the py file.
........
Diffstat (limited to 'Lib/test')
59 files changed, 39 insertions, 118 deletions
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py index 38e2b4f..678e3c4 100644 --- a/Lib/test/fork_wait.py +++ b/Lib/test/fork_wait.py @@ -10,7 +10,6 @@ active threads survive in the child after a fork(); this is an error. """ import os, sys, time, thread, unittest -from test.test_support import TestSkipped LONGSLEEP = 2 SHORTSLEEP = 0.5 diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py index 49283e4..4ffa668 100644 --- a/Lib/test/list_tests.py +++ b/Lib/test/list_tests.py @@ -5,7 +5,6 @@ Tests common to list and UserList.UserList import sys import os -import unittest from test import test_support, seq_tests def CmpToKey(mycmp): diff --git a/Lib/test/seq_tests.py b/Lib/test/seq_tests.py index 81fe627..a3815e2 100644 --- a/Lib/test/seq_tests.py +++ b/Lib/test/seq_tests.py @@ -3,7 +3,6 @@ Tests common to tuple, list and UserList.UserList """ import unittest -from test import test_support import sys # Various iterables diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index 6e844e7..a2a2519 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -1,5 +1,5 @@ import unittest -from test.test_support import verbose, run_unittest +from test.test_support import run_unittest import sys diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py index 80b0123..7a932fc 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -3,7 +3,6 @@ """Unit tests for abc.py.""" -import sys import unittest from test import test_support diff --git a/Lib/test/test_applesingle.py b/Lib/test/test_applesingle.py index 96450e3..9dfcb19 100644 --- a/Lib/test/test_applesingle.py +++ b/Lib/test/test_applesingle.py @@ -5,7 +5,6 @@ import macostools import Carbon.File import MacOS import os -import sys from test import test_support import struct import applesingle diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py index ab44a4c..730826d 100644 --- a/Lib/test/test_class.py +++ b/Lib/test/test_class.py @@ -1,7 +1,6 @@ "Test the functionality of Python classes implementing operators." import unittest -import sys from test import test_support diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py index 3ed6322..2c77931 100644 --- a/Lib/test/test_cmd.py +++ b/Lib/test/test_cmd.py @@ -5,7 +5,6 @@ Original by Michael Schneider """ -from test import test_support import cmd import sys import trace diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py index 15fe3c2..de32f3c 100644 --- a/Lib/test/test_compare.py +++ b/Lib/test/test_compare.py @@ -1,4 +1,3 @@ -import sys import unittest from test import test_support diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index cf94593..8b50e47 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -1,6 +1,5 @@ """Unit tests for the copy module.""" -import sys import copy import copy_reg diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 8ac7160..e768a9c 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -4,7 +4,6 @@ See http://www.zope.org/Members/fdrake/DateTimeWiki/TestCases """ import os -import sys import pickle import unittest diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py index 806125f..4c97a4c 100755 --- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -3,7 +3,6 @@ Roger E. Masse """ import os -import random import dbm from dbm import error from test.test_support import verbose, verify, TestSkipped, TESTFN diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py index f135780..ceb7509 100644 --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -1,6 +1,6 @@ # Minimal tests for dis module -from test.test_support import verbose, run_unittest +from test.test_support import run_unittest import unittest import sys import dis diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py index 90bf6e0..6f16241 100644 --- a/Lib/test/test_dummy_threading.py +++ b/Lib/test/test_dummy_threading.py @@ -3,7 +3,6 @@ # Create a bunch of threads, let each do some work, wait until all are done from test.test_support import verbose -import random import dummy_threading as _threading import time diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py index 736c393..e12cbd3 100644 --- a/Lib/test/test_email.py +++ b/Lib/test/test_email.py @@ -1,7 +1,6 @@ # Copyright (C) 2001-2007 Python Software Foundation # email package unit tests -import unittest # The specific tests now live in Lib/email/test from email.test.test_email import suite from test import test_support diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py index 1187d07..4284d11 100644 --- a/Lib/test/test_eof.py +++ b/Lib/test/test_eof.py @@ -1,7 +1,6 @@ #! /usr/bin/env python """test script for a few new invalid token catches""" -import os import unittest from test import test_support diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index 596a3ef..bad1440 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -1,4 +1,4 @@ -from test.test_support import verify, verbose, TestFailed, sortdict +from test.test_support import verify, TestFailed, sortdict from collections import UserDict, UserList def e(a, b): diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 2ba3bc3..aa38527 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -6,7 +6,7 @@ Nick Mathewson import unittest from test.test_support import verbose, TESTFN, run_unittest from test.test_support import unlink as safe_unlink -import sys, os, re +import sys, re from io import StringIO from fileinput import FileInput, hook_encoded diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py index dacb587..21c1761 100644 --- a/Lib/test/test_fractions.py +++ b/Lib/test/test_fractions.py @@ -1,7 +1,7 @@ """Tests for Lib/fractions.py.""" from decimal import Decimal -from test.test_support import run_unittest, verbose +from test.test_support import run_unittest import math import operator import fractions diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py index 9172576..4253141 100644 --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -1,8 +1,7 @@ import unittest from test import test_support -import sys -import warnings, re +import warnings warnings.filterwarnings("ignore", category=DeprecationWarning, message=".*integer argument expected, got float", diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index 31000df..08f7f3f 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -4,7 +4,7 @@ import unittest from test import test_support -import sys, os +import os import gzip diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index b408a18..a4f2c34 100755 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -2,7 +2,6 @@ import HTMLParser import pprint -import sys import unittest from test import test_support diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 7e5a8a5..4caf996 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1,6 +1,5 @@ import httplib import io -import sys import socket from unittest import TestCase diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 3b0a13d..13a3bfd 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -1,5 +1,4 @@ import imp -import thread import unittest from test import test_support diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py index 9a22020..71cfb15 100644 --- a/Lib/test/test_index.py +++ b/Lib/test/test_index.py @@ -1,7 +1,6 @@ import unittest from test import test_support import operator -import sys maxsize = test_support.MAX_Py_ssize_t minsize = -maxsize-1 diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index 5b84a42..b3b2195 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -1,4 +1,3 @@ -import unittest import sys from test import test_support, list_tests diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index d1a72bd..9ea60a9 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -3,7 +3,6 @@ import os import sys import pickle -import traceback from io import StringIO from test.test_support import verbose, run_unittest, TestSkipped import unittest @@ -791,6 +790,14 @@ class MinidomTest(unittest.TestCase): "testNormalize -- single empty node removed") doc.unlink() + def testBug1433694(self): + doc = parseString("<o><i/>t</o>") + node = doc.documentElement + node.childNodes[1].nodeValue = "" + node.normalize() + self.confirm(node.childNodes[-1].nextSibling == None, + "Final child's .nextSibling should be None") + def testSiblings(self): doc = parseString("<doc><?pi?>text?<elm/></doc>") root = doc.documentElement diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py index d091c6b..35c765e 100644 --- a/Lib/test/test_module.py +++ b/Lib/test/test_module.py @@ -1,6 +1,6 @@ # Test the module type import unittest -from test.test_support import verbose, run_unittest +from test.test_support import run_unittest import sys ModuleType = type(sys) diff --git a/Lib/test/test_modulefinder.py b/Lib/test/test_modulefinder.py index 3bc22ab..80c06d7 100644 --- a/Lib/test/test_modulefinder.py +++ b/Lib/test/test_modulefinder.py @@ -1,5 +1,5 @@ import __future__ -import sys, os +import os import unittest import distutils.dir_util import tempfile diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py index 6b67057..42df9d7 100644 --- a/Lib/test/test_multibytecodec_support.py +++ b/Lib/test/test_multibytecodec_support.py @@ -4,7 +4,7 @@ # Common Unittest Routines for CJK codecs # -import sys, codecs, os.path +import sys, codecs import unittest, re from test import test_support from io import BytesIO diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py index 1cfdd50..71de869 100644 --- a/Lib/test/test_optparse.py +++ b/Lib/test/test_optparse.py @@ -15,7 +15,6 @@ import copy import unittest from io import StringIO -from pprint import pprint from test import test_support diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py index 97d5989..8f9bf6f 100644 --- a/Lib/test/test_ossaudiodev.py +++ b/Lib/test/test_ossaudiodev.py @@ -1,14 +1,11 @@ from test import test_support test_support.requires('audio') -from test.test_support import verbose, findfile, TestSkipped +from test.test_support import findfile, TestSkipped import errno -import fcntl import ossaudiodev -import os import sys -import select import sunaudio import time import audioop diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py index f54381f..aa09a6a 100644 --- a/Lib/test/test_pickle.py +++ b/Lib/test/test_pickle.py @@ -1,5 +1,4 @@ import pickle -import unittest import io from test import test_support diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index 630956d..dcc7433 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -4,7 +4,6 @@ import sys import os import tempfile import textwrap -import traceback import unittest from test import test_support diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py index 5c6a059..883b01f 100644 --- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -3,7 +3,6 @@ import unittest import plistlib import os -import time import datetime from test import test_support diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py index a6110e6..cd9bfb0 100644 --- a/Lib/test/test_poll.py +++ b/Lib/test/test_poll.py @@ -1,6 +1,6 @@ # Test case for the os.poll() function -import sys, os, select, random, unittest +import os, select, random, unittest from test.test_support import TestSkipped, TESTFN, run_unittest try: diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index efd5fb0..13f8f9e 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -9,7 +9,6 @@ except ImportError: import time import os -import sys import unittest import warnings warnings.filterwarnings('ignore', '.* potential security risk .*', diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py index f041823..c96ae6d 100644 --- a/Lib/test/test_pyclbr.py +++ b/Lib/test/test_pyclbr.py @@ -3,7 +3,7 @@ Nick Mathewson ''' from test.test_support import run_unittest -import unittest, sys +import sys from types import FunctionType, MethodType, BuiltinFunctionType import pyclbr from unittest import TestCase diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 86440b5..b66caf8 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -1,7 +1,6 @@ import unittest from test import test_support -import os import resource import time diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py index b563c9c..1f5dd64 100644 --- a/Lib/test/test_rfc822.py +++ b/Lib/test/test_rfc822.py @@ -1,5 +1,4 @@ import rfc822 -import sys import unittest from test import test_support diff --git a/Lib/test/test_scriptpackages.py b/Lib/test/test_scriptpackages.py index a2e03f9..ee14be2 100644 --- a/Lib/test/test_scriptpackages.py +++ b/Lib/test/test_scriptpackages.py @@ -1,9 +1,6 @@ # Copyright (C) 2003 Python Software Foundation import unittest -import os -import sys -import tempfile from test import test_support import aetools diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py index f0f8ad6..374b921 100644 --- a/Lib/test/test_sgmllib.py +++ b/Lib/test/test_sgmllib.py @@ -1,4 +1,3 @@ -import htmlentitydefs import pprint import re import sgmllib @@ -116,7 +115,7 @@ class SGMLParserTestCase(unittest.TestCase): try: events = self.get_events(source) except: - import sys + #import sys #print >>sys.stderr, pprint.pformat(self.events) raise if events != expected_events: diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 4624ea6..b80d6e6 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -5,12 +5,11 @@ executing have not been removed. """ import unittest -from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN +from test.test_support import TestSkipped, run_unittest, TESTFN import builtins import os import sys import encodings -import tempfile # Need to make sure to not import 'site' if someone specified ``-S`` at the # command-line. Detect this by just making sure 'site' has not been imported # already. diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 0fccdd9..69f0b53 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -9,7 +9,6 @@ import imp import select import time import threading -from functools import wraps import unittest import SocketServer diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py index f033772..c1523e1 100644 --- a/Lib/test/test_sqlite.py +++ b/Lib/test/test_sqlite.py @@ -1,5 +1,4 @@ from test.test_support import run_unittest, TestSkipped -import unittest try: import _sqlite3 diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py index c6db3dd..0870134 100755 --- a/Lib/test/test_strftime.py +++ b/Lib/test/test_strftime.py @@ -2,7 +2,7 @@ # Sanity checker for time.strftime -import time, calendar, sys, os, re +import time, calendar, sys, re from test.test_support import verbose def main(): diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 0fd5d88..ba36448 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -10,7 +10,6 @@ import sys import os import os.path import warnings -import types import unittest class Error(Exception): diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py index 1da0ef3..62c5d71 100644 --- a/Lib/test/test_tuple.py +++ b/Lib/test/test_tuple.py @@ -1,4 +1,3 @@ -import unittest from test import test_support, seq_tests class TupleTest(seq_tests.CommonTest): diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py index 75033ed..a90b5e5 100644 --- a/Lib/test/test_unpack.py +++ b/Lib/test/test_unpack.py @@ -122,7 +122,6 @@ error) __test__ = {'doctests' : doctests} def test_main(verbose=False): - import sys from test import test_support from test import test_unpack test_support.run_doctest(test_unpack, verbose) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index c233e35..d58414c 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -8,10 +8,6 @@ from test import test_support import os import mimetools import tempfile -import ftplib -import threading -import socket -import time def hexescape(char): """Escape char as RFC 2396 specifies""" diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 199119a..6ceec06 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1,7 +1,7 @@ import unittest from test import test_support -import os, socket +import os import io import urllib2 @@ -584,7 +584,7 @@ class HandlerTests(unittest.TestCase): self.assertEqual(int(headers["Content-length"]), len(data)) def test_file(self): - import time, rfc822, socket + import rfc822, socket h = urllib2.FileHandler() o = h.parent = MockOpener() @@ -988,7 +988,7 @@ class HandlerTests(unittest.TestCase): def _test_basic_auth(self, opener, auth_handler, auth_header, realm, http_handler, password_manager, request_url, protected_url): - import base64, httplib + import base64 user, password = "wile", "coyote" # .add_password() fed through to password manager diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index f0b5dea..663330b 100644 --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import sys import threading import urlparse import urllib2 diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py index 643caf9..3a8a8b4 100644 --- a/Lib/test/test_userdict.py +++ b/Lib/test/test_userdict.py @@ -1,6 +1,5 @@ # Check every path through every method of UserDict -import unittest from test import test_support, mapping_tests import collections diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py index 9d012e0..a0daa4e 100644 --- a/Lib/test/test_userlist.py +++ b/Lib/test/test_userlist.py @@ -1,7 +1,6 @@ # Check every path through every method of UserList from collections import UserList -import unittest from test import test_support, list_tests class UserListTest(list_tests.CommonTest): diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py index a0fefc3..e8fb135 100755 --- a/Lib/test/test_userstring.py +++ b/Lib/test/test_userstring.py @@ -2,7 +2,6 @@ # UserString is a wrapper around the native builtin string type. # UserString instances should behave similar to builtin string objects. -import unittest import string from test import test_support, string_tests diff --git a/Lib/test/test_whichdb.py b/Lib/test/test_whichdb.py index 7746329..e63eb0f 100644 --- a/Lib/test/test_whichdb.py +++ b/Lib/test/test_whichdb.py @@ -8,7 +8,6 @@ import test.test_support import unittest import whichdb import anydbm -import tempfile import glob from test.test_anydbm import delete_files, dbm_iterator diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index 1a6b7f3..8470584 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -2,7 +2,8 @@ # all included components work as they should. For a more extensive # test suite, see the selftest script in the ElementTree distribution. -import doctest, sys +import doctest +import sys from test import test_support diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py index c8eec40..80e91d1 100644 --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -1,6 +1,7 @@ # xml.etree test for cElementTree -import doctest, sys +import doctest +import sys from test import test_support diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 092be51..0836533 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -26,10 +26,6 @@ alist = [{'astring': 'foo@bar.baz.spam', (2005, 2, 10, 11, 41, 23, 0, 1, -1)), 'datetime3': xmlrpclib.DateTime( datetime.datetime(2005, 2, 10, 11, 41, 23)), - 'datetime4': xmlrpclib.DateTime( - datetime.date(2005, 2, 10)), - 'datetime5': xmlrpclib.DateTime( - datetime.time(11, 41, 23)), }] class XMLRPCTestCase(unittest.TestCase): @@ -53,34 +49,14 @@ class XMLRPCTestCase(unittest.TestCase): (newdt,), m = xmlrpclib.loads(s, use_datetime=0) self.assertEquals(newdt, xmlrpclib.DateTime('20050210T11:41:23')) - def test_dump_bare_date(self): - # This checks that an unwrapped datetime.date object can be handled - # by the marshalling code. This can't be done via test_dump_load() - # since the unmarshaller produces a datetime object - d = datetime.datetime(2005, 2, 10, 11, 41, 23).date() - s = xmlrpclib.dumps((d,)) - (newd,), m = xmlrpclib.loads(s, use_datetime=1) - self.assertEquals(newd.date(), d) - self.assertEquals(newd.time(), datetime.time(0, 0, 0)) - self.assertEquals(m, None) - - (newdt,), m = xmlrpclib.loads(s, use_datetime=0) - self.assertEquals(newdt, xmlrpclib.DateTime('20050210T00:00:00')) - - def test_dump_bare_time(self): - # This checks that an unwrapped datetime.time object can be handled - # by the marshalling code. This can't be done via test_dump_load() - # since the unmarshaller produces a datetime object - t = datetime.datetime(2005, 2, 10, 11, 41, 23).time() - s = xmlrpclib.dumps((t,)) - (newt,), m = xmlrpclib.loads(s, use_datetime=1) - today = datetime.datetime.now().date().strftime("%Y%m%d") - self.assertEquals(newt.time(), t) - self.assertEquals(newt.date(), datetime.datetime.now().date()) - self.assertEquals(m, None) - - (newdt,), m = xmlrpclib.loads(s, use_datetime=0) - self.assertEquals(newdt, xmlrpclib.DateTime('%sT11:41:23'%today)) + def test_cmp_datetime_DateTime(self): + now = datetime.datetime.now() + dt = xmlrpclib.DateTime(now.timetuple()) + self.assert_(dt == now) + self.assert_(now == dt) + then = now + datetime.timedelta(seconds=4) + self.assert_(then >= dt) + self.assert_(dt < then) def test_bug_1164912 (self): d = xmlrpclib.DateTime() @@ -201,21 +177,6 @@ class DateTimeTestCase(unittest.TestCase): t = xmlrpclib.DateTime(d) self.assertEqual(str(t), '20070102T03:04:05') - def test_datetime_date(self): - d = datetime.date(2007,9,8) - t = xmlrpclib.DateTime(d) - self.assertEqual(str(t), '20070908T00:00:00') - - def test_datetime_time(self): - d = datetime.time(13,17,19) - # allow for date rollover by checking today's or tomorrow's dates - dd1 = datetime.datetime.now().date() - dd2 = dd1 + datetime.timedelta(days=1) - vals = (dd1.strftime('%Y%m%dT13:17:19'), - dd2.strftime('%Y%m%dT13:17:19')) - t = xmlrpclib.DateTime(d) - self.assertEqual(str(t) in vals, True) - def test_repr(self): d = datetime.datetime(2007,1,2,3,4,5) t = xmlrpclib.DateTime(d) |