#1055 Fix parser not using microseconds from default

Open Daniel ffe4
Showing 2 of 3 files from the diff.

@@ -1139,7 +1139,7 @@
Loading
1139 1139
    def _parsems(self, value):
1140 1140
        """Parse a I[.F] seconds value into (seconds, microseconds)."""
1141 1141
        if "." not in value:
1142 -
            return int(value), 0
1142 +
            return int(value), None
1143 1143
        else:
1144 1144
            i, f = value.split(".")
1145 1145
            return int(i), int(f.ljust(6, "0")[:6])

@@ -166,6 +166,15 @@
Loading
166 166
    assert parse(parsable_text, default=datetime(2003, 9, 25)) == expected_datetime, assertion_message
167 167
168 168
169 +
@pytest.mark.parametrize("parsable_text", ["2000-01-01T16:04:10", "20000101T160410"])
170 +
def test_parser_default_with_milliseconds(parsable_text):
171 +
    # https://github.com/dateutil/dateutil/issues/1032
172 +
    # If microseconds were not part of the date string but seconds were
173 +
    # parser would set the microseconds to zero instead of the default.
174 +
    expected_datetime = datetime(2000, 1, 1, 16, 4, 10, 999999)
175 +
    assert parse(parsable_text, default=expected_datetime) == expected_datetime
176 +
177 +
169 178
@pytest.mark.parametrize('sep', ['-', '.', '/', ' '])
170 179
def test_parse_dayfirst(sep):
171 180
    expected = datetime(2003, 9, 10)

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
dateutil +<.01% 95.99%
Project Totals (32 files) 95.99%
Loading