FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-15873: Implement [date][time].fromisoformat by pganssle · Pull Request #4699 · python/cpython · GitHub

Repository navigation

Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b451a83
Add C implementation of date.fromisoformat
pganssle Dec 1, 2017
4ccef0a
Add python implementation of date.fromisoformat
pganssle Dec 1, 2017
13e8e48
Add tests for date.fromisoformat
pganssle Dec 1, 2017
6fa5c55
Implement C version of datetime.fromisoformat
pganssle Dec 2, 2017
0d44220
Add initial test suite for C-only datetime.fromisoformat
pganssle Dec 2, 2017
327d0fc
Add C implementation of time.fromisoformat()
pganssle Dec 4, 2017
52b2175
Add tests for time.isoformat()
pganssle Dec 4, 2017
f1b78af
Add pure python implementation of time.fromisoformat()
pganssle Dec 4, 2017
aeaa9ca
Add tests for pure python time.fromisoformat()
pganssle Dec 4, 2017
094ccf4
Add pure python implementation of datetime.fromisoformat
pganssle Dec 4, 2017
2a8120d
Enable tests for pure python datetime.fromisoformat
pganssle Dec 4, 2017
af9e6d0
Add documentation for [date][time].fromisoformat()
pganssle Dec 4, 2017
cf802af
Consolidate helper functions into parse_digits
pganssle Dec 5, 2017
626d239
Refactor datetime.isoformat round trip tests
pganssle Dec 5, 2017
7c771e7
Refactor C code for PEP 7
pganssle Dec 5, 2017
8fbd752
Add support for seconds in fromisoformat offsets
pganssle Dec 6, 2017
4d55e05
Fix pure python implementation of isoformat() for sub-second zones
pganssle Dec 9, 2017
5a233fb
Add support for subsecond offsets to fromisoformat
pganssle Dec 9, 2017
9fa91db
Fix documentation and pure python error catching in fromisoformat
pganssle Dec 18, 2017
ffdb2af
Drop unsupported sep parameter in _tzstr
pganssle Dec 18, 2017
18a5fa8
Add test for ambiguous isoformat strings
pganssle Dec 18, 2017
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Refactor datetime.isoformat round trip tests
  • Loading branch information
pganssle committed Dec 10, 2017
commit 626d239b911565825cf47a683425506c51aed731
26 changes: 17 additions & 9 deletions Lib/test/datetimetester.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2394,27 +2394,19 @@ def test_fromisoformat_datetime(self):
# Test that isoformat() is reversible
base_dates = [
(1, 1, 1),
(1000, 2, 14),
(1900, 1, 1),
(2004, 11, 12),
(2004, 4, 3),
(2017, 5, 30)
]

base_times = [
(0, 0, 0, 0),
(0, 0, 0, 241000),
(0, 0, 0, 234567),
(23, 59, 47),
(12, 30, 45, 234567)
]

separators = [
' ', 'T', '\u007f', # 1-bit widths
'\u0080', 'ʁ', # 2-bit widths
'ᛇ', '時', # 3-bit widths
'🐍' # 4-bit widths
]
separators = [' ', 'T']

tzinfos = [None, timezone.utc,
timezone(timedelta(hours=-5)),
Expand All @@ -2434,6 +2426,22 @@ def test_fromisoformat_datetime(self):
dt_rt = self.theclass.fromisoformat(dtstr)
self.assertEqual(dt, dt_rt)

def test_fromisoformat_separators(self):
separators = [
' ', 'T', '\u007f', # 1-bit widths
'\u0080', 'ʁ', # 2-bit widths
'ᛇ', '時', # 3-bit widths
'🐍' # 4-bit widths
]

for sep in separators:
dt = self.theclass(2018, 1, 31, 23, 59, 47, 124789)
dtstr = dt.isoformat(sep=sep)

with self.subTest(dtstr=dtstr):
dt_rt = self.theclass.fromisoformat(dtstr)
self.assertEqual(dt, dt_rt)

def test_fromisoformat_timespecs(self):
datetime_bases = [
(2009, 12, 4, 8, 17, 45, 123456),
Expand Down

Back | FazBrowse Home | New Git URL