#1057 Fix xfail tests for unimplemented parser cases

Open Daniel ffe4
Showing 1 of 1 files from the diff.

@@ -7,7 +7,7 @@
Loading
7 7
import sys
8 8
9 9
from dateutil import tz
10 -
from dateutil.tz import tzoffset
10 +
from dateutil.tz import tzoffset, gettz
11 11
from dateutil.parser import parse, parserinfo
12 12
from dateutil.parser import ParserError
13 13
from dateutil.parser import UnknownTimezoneWarning
@@ -775,8 +775,8 @@
Loading
775 775
        # The parser is choosing the wrong part for hour
776 776
        # causing datetime to raise an exception.
777 777
        dtstr = '1237 PM BRST Mon Oct 30 2017'
778 -
        res = parse(dtstr, tzinfo=self.tzinfos)
779 -
        assert res == datetime(2017, 10, 30, 12, 37, tzinfo=self.tzinfos)
778 +
        res = parse(dtstr, tzinfos={"BRST": gettz("America/Sao_Paolo")})
779 +
        assert res == datetime(2017, 10, 30, 12, 37, tzinfo=gettz("America/Sao_Paolo"))
780 780
781 781
    @pytest.mark.xfail
782 782
    def test_YmdH_M_S(self):
@@ -800,12 +800,13 @@
Loading
800 800
        assert res.year == 2001, res
801 801
802 802
    @pytest.mark.xfail
803 -
    def test_ad_nospace(self):
803 +
    @pytest.mark.parametrize(
804 +
        "dstr", [" 6AD May 19", " 06AD May 19", " 006AD May 19", " 0006AD May 19"]
805 +
    )
806 +
    def test_ad_nospace(self, dstr):
804 807
        expected = datetime(6, 5, 19)
805 -
        for dstr in [' 6AD May 19', ' 06AD May 19',
806 -
                     ' 006AD May 19', ' 0006AD May 19']:
807 -
            res = parse(dstr)
808 -
            assert res == expected, (dstr, res)
808 +
        res = parse(dstr)
809 +
        assert res == expected, (dstr, res)
809 810
810 811
    @pytest.mark.xfail
811 812
    def test_four_letter_day(self):
@@ -833,7 +834,7 @@
Loading
833 834
    def test_extraneous_year(self):
834 835
        # This was found in the wild at insidertrading.org
835 836
        dstr = "2011 MARTIN CHILDREN'S IRREVOCABLE TRUST u/a/d NOVEMBER 7, 2012"
836 -
        res = parse(dstr, fuzzy_with_tokens=True)
837 +
        res = parse(dstr, fuzzy=True)
837 838
        expected = datetime(2012, 11, 7)
838 839
        assert res == expected
839 840
@@ -854,15 +855,15 @@
Loading
854 855
        # This was found in the wild at insidertrading.org
855 856
        dstr = ("Berylson Amy Smith 1998 Grantor Retained Annuity Trust "
856 857
                "u/d/t November 2, 1998 f/b/o Jennifer L Berylson")
857 -
        res = parse(dstr, fuzzy_with_tokens=True)
858 +
        res = parse(dstr, fuzzy=True)
858 859
        expected = datetime(1998, 11, 2)
859 860
        assert res == expected
860 861
861 862
    @pytest.mark.xfail
862 863
    def test_extraneous_year3(self):
863 864
        # This was found in the wild at insidertrading.org
864 865
        dstr = "SMITH R &  WEISS D 94 CHILD TR FBO M W SMITH UDT 12/1/1994"
865 -
        res = parse(dstr, fuzzy_with_tokens=True)
866 +
        res = parse(dstr, fuzzy=True)
866 867
        expected = datetime(1994, 12, 1)
867 868
        assert res == expected
868 869

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 0.01% 96.00%
Project Totals (32 files) 96.00%
Loading