diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2012-06-22 20:19:51 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2012-06-22 20:19:51 (GMT) |
commit | ebd1b1dcb7a944ace00fd4f6565b5a2627eab2ce (patch) | |
tree | b2a3f32d4076a504074ca9792d05b1c15a81114b /Lib/test | |
parent | 7c771ca4134a956fb9078041522ab920ae182f46 (diff) | |
parent | 1326e8f301bea3032e4f0b7659953da7bef3846b (diff) | |
download | cpython-ebd1b1dcb7a944ace00fd4f6565b5a2627eab2ce.zip cpython-ebd1b1dcb7a944ace00fd4f6565b5a2627eab2ce.tar.gz cpython-ebd1b1dcb7a944ace00fd4f6565b5a2627eab2ce.tar.bz2 |
Merge heads
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/datetimetester.py | 6 | ||||
-rw-r--r-- | Lib/test/test_capi.py | 40 |
2 files changed, 25 insertions, 21 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 4181d4f..a417170 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -3278,16 +3278,18 @@ class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase): self.assertEqual(dt.astimezone(None), dt) self.assertEqual(dt.astimezone(), dt) + # Note that offset in TZ variable has the opposite sign to that + # produced by %z directive. @support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0') def test_astimezone_default_eastern(self): dt = self.theclass(2012, 11, 4, 6, 30, tzinfo=timezone.utc) local = dt.astimezone() self.assertEqual(dt, local) - self.assertEqual(local.strftime("%z %Z"), "+0500 EST") + self.assertEqual(local.strftime("%z %Z"), "-0500 EST") dt = self.theclass(2012, 11, 4, 5, 30, tzinfo=timezone.utc) local = dt.astimezone() self.assertEqual(dt, local) - self.assertEqual(local.strftime("%z %Z"), "+0400 EDT") + self.assertEqual(local.strftime("%z %Z"), "-0400 EDT") def test_aware_subtract(self): cls = self.theclass diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index e24bd6f..2692b89d 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -222,36 +222,38 @@ class SkipitemTest(unittest.TestCase): in Python/getargs.c, but neglected to update our poor friend skipitem() in the same file. (If so, shame on you!) - This function brute-force tests all** ASCII characters (1 to 127 - inclusive) as format units, checking to see that - PyArg_ParseTupleAndKeywords() return consistent errors both when - the unit is attempted to be used and when it is skipped. If the - format unit doesn't exist, we'll get one of two specific error - messages (one for used, one for skipped); if it does exist we - *won't* get that error--we'll get either no error or some other - error. If we get the "does not exist" error for one test and - not for the other, there's a mismatch, and the test fails. - - ** Okay, it actually skips some ASCII characters. Some characters - have special funny semantics, and it would be difficult to - accomodate them here. + With a few exceptions**, this function brute-force tests all + printable ASCII*** characters (32 to 126 inclusive) as format units, + checking to see that PyArg_ParseTupleAndKeywords() return consistent + errors both when the unit is attempted to be used and when it is + skipped. If the format unit doesn't exist, we'll get one of two + specific error messages (one for used, one for skipped); if it does + exist we *won't* get that error--we'll get either no error or some + other error. If we get the specific "does not exist" error for one + test and not for the other, there's a mismatch, and the test fails. + + ** Some format units have special funny semantics and it would + be difficult to accomodate them here. Since these are all + well-established and properly skipped in skipitem() we can + get away with not testing them--this test is really intended + to catch *new* format units. + + *** Python C source files must be ASCII. Therefore it's impossible + to have non-ASCII format units. + """ empty_tuple = () tuple_1 = (0,) dict_b = {'b':1} keywords = ["a", "b"] - # Python C source files must be ASCII, - # therefore we'll never have a format unit > 127 - for i in range(1, 128): + for i in range(32, 127): c = chr(i) - # skip non-printable characters, no one is insane enough to define - # one as a format unit # skip parentheses, the error reporting is inconsistent about them # skip 'e', it's always a two-character code # skip '|' and '$', they don't represent arguments anyway - if (not c.isprintable()) or (c in '()e|$'): + if c in '()e|$': continue # test the format unit when not skipped |