mirror of
https://github.com/bspeice/dtparse
synced 2024-12-22 12:28:08 -05:00
Ignore tests needing relativedelta
This commit is contained in:
parent
132fe314d5
commit
7d565d3a78
@ -3,12 +3,12 @@ from datetime import datetime
|
|||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
'test_parse_default': [
|
'test_parse_default': [
|
||||||
"Thu Sep 25 10:36:28", "Thu Sep 10:36:28", "Thu 10:36:28",
|
"Thu Sep 25 10:36:28",
|
||||||
"Sep 10:36:28", "10:36:28", "10:36", "Sep 2003", "Sep", "2003",
|
"Sep 10:36:28", "10:36:28", "10:36", "Sep 2003", "Sep", "2003",
|
||||||
"10h36m28.5s", "10h36m28s", "10h36m", "10h", "10 h 36", "10 h 36.5",
|
"10h36m28.5s", "10h36m28s", "10h36m", "10h", "10 h 36", "10 h 36.5",
|
||||||
"36 m 5", "36 m 5 s", "36 m 05", "36 m 05 s", "10h am", "10h pm",
|
"36 m 5", "36 m 5 s", "36 m 05", "36 m 05 s", "10h am", "10h pm",
|
||||||
"10am", "10pm", "10:00 am", "10:00 pm", "10:00am", "10:00pm",
|
"10am", "10pm", "10:00 am", "10:00 pm", "10:00am", "10:00pm",
|
||||||
"10:00a.m", "10:00p.m", "10:00a.m.", "10:00p.m.", "Wed", "Wednesday",
|
"10:00a.m", "10:00p.m", "10:00a.m.", "10:00p.m.",
|
||||||
"October", "31-Dec-00", "0:01:02", "12h 01m02s am", "12:08 PM",
|
"October", "31-Dec-00", "0:01:02", "12h 01m02s am", "12:08 PM",
|
||||||
"01h02m03", "01h02", "01h02s", "01m02", "01m02h", "2004 10 Apr 11h30m",
|
"01h02m03", "01h02", "01h02s", "01m02", "01m02h", "2004 10 Apr 11h30m",
|
||||||
# testPertain
|
# testPertain
|
||||||
@ -77,7 +77,10 @@ tests = {
|
|||||||
'November 5, 1994, 8:15:30 am EST', '1994-11-05T08:15:30-05:00',
|
'November 5, 1994, 8:15:30 am EST', '1994-11-05T08:15:30-05:00',
|
||||||
'1994-11-05T08:15:30Z', '1976-07-04T00:01:02Z',
|
'1994-11-05T08:15:30Z', '1976-07-04T00:01:02Z',
|
||||||
'Tue Apr 4 00:22:12 PDT 1995'
|
'Tue Apr 4 00:22:12 PDT 1995'
|
||||||
]
|
],
|
||||||
|
'test_parse_default_ignore': [
|
||||||
|
"Thu Sep 10:36:28", "Thu 10:36:28", "Wed", "Wednesday"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -138,6 +141,13 @@ def test_parse_ignoretz(i, s):
|
|||||||
d = parse(s, ignoretz=True)
|
d = parse(s, ignoretz=True)
|
||||||
return TEST_PARSE_IGNORETZ.format(i=i, d=d, s=s)
|
return TEST_PARSE_IGNORETZ.format(i=i, d=d, s=s)
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_default_ignore(i, s):
|
||||||
|
default = datetime(2003, 9, 25)
|
||||||
|
d = parse(s, default=default)
|
||||||
|
|
||||||
|
return TEST_PARSE_DEFAULT_IGNORE.format(i=i, d=d, s=s)
|
||||||
|
|
||||||
# Here lies all the ugly junk.
|
# Here lies all the ugly junk.
|
||||||
TEST_HEADER = '''
|
TEST_HEADER = '''
|
||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
@ -338,6 +348,21 @@ fn test_parse_ignoretz{i}() {{
|
|||||||
None, true, HashMap::new());
|
None, true, HashMap::new());
|
||||||
}}\n'''
|
}}\n'''
|
||||||
|
|
||||||
|
TEST_PARSE_DEFAULT_IGNORE = '''
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn test_parse_default_ignore{i}() {{
|
||||||
|
let info = ParserInfo::default();
|
||||||
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
|
let pdt = PyDateTime {{
|
||||||
|
year: {d.year}, month: {d.month}, day: {d.day},
|
||||||
|
hour: {d.hour}, minute: {d.minute}, second: {d.second},
|
||||||
|
micros: {d.microsecond}, tzo: None
|
||||||
|
}};
|
||||||
|
parse_and_assert(pdt, info, "{s}", None, None, false, false,
|
||||||
|
Some(default_rsdate), false, HashMap::new());
|
||||||
|
}}\n'''
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
14
src/lib.rs
14
src/lib.rs
@ -60,6 +60,7 @@ impl From<ParseIntError> for ParseInternalError {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
|
AmbiguousWeekday,
|
||||||
InternalError(ParseInternalError),
|
InternalError(ParseInternalError),
|
||||||
InvalidMonth,
|
InvalidMonth,
|
||||||
UnrecognizedToken(String),
|
UnrecognizedToken(String),
|
||||||
@ -791,7 +792,7 @@ impl Parser {
|
|||||||
default: Option<&NaiveDateTime>,
|
default: Option<&NaiveDateTime>,
|
||||||
ignoretz: bool,
|
ignoretz: bool,
|
||||||
tzinfos: HashMap<String, i32>,
|
tzinfos: HashMap<String, i32>,
|
||||||
) -> Result<(NaiveDateTime, Option<FixedOffset>, Option<Vec<String>>), ParseError> {
|
) -> ParseResult<(NaiveDateTime, Option<FixedOffset>, Option<Vec<String>>)> {
|
||||||
let default_date = default.unwrap_or(&Local::now().naive_local()).date();
|
let default_date = default.unwrap_or(&Local::now().naive_local()).date();
|
||||||
|
|
||||||
let default_ts = NaiveDateTime::new(default_date, NaiveTime::from_hms(0, 0, 0));
|
let default_ts = NaiveDateTime::new(default_date, NaiveTime::from_hms(0, 0, 0));
|
||||||
@ -800,7 +801,7 @@ impl Parser {
|
|||||||
let (res, tokens) =
|
let (res, tokens) =
|
||||||
self.parse_with_tokens(timestr, dayfirst, yearfirst, fuzzy, fuzzy_with_tokens)?;
|
self.parse_with_tokens(timestr, dayfirst, yearfirst, fuzzy, fuzzy_with_tokens)?;
|
||||||
|
|
||||||
let naive = self.build_naive(&res, &default_ts);
|
let naive = self.build_naive(&res, &default_ts)?;
|
||||||
|
|
||||||
if !ignoretz {
|
if !ignoretz {
|
||||||
let offset = self.build_tzaware(&naive, &res, tzinfos)?;
|
let offset = self.build_tzaware(&naive, &res, tzinfos)?;
|
||||||
@ -1011,8 +1012,11 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_naive(&self, res: &ParsingResult, default: &NaiveDateTime) -> NaiveDateTime {
|
fn build_naive(&self, res: &ParsingResult, default: &NaiveDateTime) -> ParseResult<NaiveDateTime> {
|
||||||
// TODO: Handle weekday here
|
// TODO: Handle weekday here - dateutils uses relativedelta to accomplish this
|
||||||
|
if res.weekday.is_some() && res.day.is_none() {
|
||||||
|
return Err(ParseError::AmbiguousWeekday);
|
||||||
|
}
|
||||||
|
|
||||||
let y = res.year.unwrap_or(default.year());
|
let y = res.year.unwrap_or(default.year());
|
||||||
let m = res.month.unwrap_or(default.month() as i32) as u32;
|
let m = res.month.unwrap_or(default.month() as i32) as u32;
|
||||||
@ -1032,7 +1036,7 @@ impl Parser {
|
|||||||
.unwrap_or(default.timestamp_subsec_micros() as i32) as u32,
|
.unwrap_or(default.timestamp_subsec_micros() as i32) as u32,
|
||||||
);
|
);
|
||||||
|
|
||||||
NaiveDateTime::new(d, t)
|
Ok(NaiveDateTime::new(d, t))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_tzaware(
|
fn build_tzaware(
|
||||||
|
@ -102,38 +102,12 @@ fn test_parse_default1() {
|
|||||||
hour: 10, minute: 36, second: 28,
|
hour: 10, minute: 36, second: 28,
|
||||||
micros: 0, tzo: None
|
micros: 0, tzo: None
|
||||||
};
|
};
|
||||||
parse_and_assert(pdt, info, "Thu Sep 10:36:28", None, None, false, false,
|
parse_and_assert(pdt, info, "Sep 10:36:28", None, None, false, false,
|
||||||
Some(default_rsdate), false, HashMap::new());
|
Some(default_rsdate), false, HashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default2() {
|
fn test_parse_default2() {
|
||||||
let info = ParserInfo::default();
|
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
|
||||||
let pdt = PyDateTime {
|
|
||||||
year: 2003, month: 9, day: 25,
|
|
||||||
hour: 10, minute: 36, second: 28,
|
|
||||||
micros: 0, tzo: None
|
|
||||||
};
|
|
||||||
parse_and_assert(pdt, info, "Thu 10:36:28", None, None, false, false,
|
|
||||||
Some(default_rsdate), false, HashMap::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_default3() {
|
|
||||||
let info = ParserInfo::default();
|
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
|
||||||
let pdt = PyDateTime {
|
|
||||||
year: 2003, month: 9, day: 25,
|
|
||||||
hour: 10, minute: 36, second: 28,
|
|
||||||
micros: 0, tzo: None
|
|
||||||
};
|
|
||||||
parse_and_assert(pdt, info, "Sep 10:36:28", None, None, false, false,
|
|
||||||
Some(default_rsdate), false, HashMap::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_default4() {
|
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -146,7 +120,7 @@ fn test_parse_default4() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default5() {
|
fn test_parse_default3() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -159,7 +133,7 @@ fn test_parse_default5() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default6() {
|
fn test_parse_default4() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -172,7 +146,7 @@ fn test_parse_default6() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default7() {
|
fn test_parse_default5() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -185,7 +159,7 @@ fn test_parse_default7() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default8() {
|
fn test_parse_default6() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -198,7 +172,7 @@ fn test_parse_default8() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default9() {
|
fn test_parse_default7() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -211,7 +185,7 @@ fn test_parse_default9() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default10() {
|
fn test_parse_default8() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -224,7 +198,7 @@ fn test_parse_default10() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default11() {
|
fn test_parse_default9() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -237,7 +211,7 @@ fn test_parse_default11() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default12() {
|
fn test_parse_default10() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -250,7 +224,7 @@ fn test_parse_default12() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default13() {
|
fn test_parse_default11() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -263,7 +237,7 @@ fn test_parse_default13() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default14() {
|
fn test_parse_default12() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -276,7 +250,7 @@ fn test_parse_default14() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default15() {
|
fn test_parse_default13() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -289,7 +263,7 @@ fn test_parse_default15() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default16() {
|
fn test_parse_default14() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -302,7 +276,7 @@ fn test_parse_default16() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default17() {
|
fn test_parse_default15() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -315,7 +289,7 @@ fn test_parse_default17() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default18() {
|
fn test_parse_default16() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -328,7 +302,7 @@ fn test_parse_default18() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default19() {
|
fn test_parse_default17() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -341,7 +315,7 @@ fn test_parse_default19() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default20() {
|
fn test_parse_default18() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -354,7 +328,7 @@ fn test_parse_default20() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default21() {
|
fn test_parse_default19() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -367,7 +341,7 @@ fn test_parse_default21() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default22() {
|
fn test_parse_default20() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -380,7 +354,7 @@ fn test_parse_default22() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default23() {
|
fn test_parse_default21() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -393,7 +367,7 @@ fn test_parse_default23() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default24() {
|
fn test_parse_default22() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -406,7 +380,7 @@ fn test_parse_default24() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default25() {
|
fn test_parse_default23() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -419,7 +393,7 @@ fn test_parse_default25() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default26() {
|
fn test_parse_default24() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -432,7 +406,7 @@ fn test_parse_default26() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default27() {
|
fn test_parse_default25() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -445,7 +419,7 @@ fn test_parse_default27() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default28() {
|
fn test_parse_default26() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -458,7 +432,7 @@ fn test_parse_default28() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default29() {
|
fn test_parse_default27() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -471,7 +445,7 @@ fn test_parse_default29() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default30() {
|
fn test_parse_default28() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -484,33 +458,7 @@ fn test_parse_default30() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default31() {
|
fn test_parse_default29() {
|
||||||
let info = ParserInfo::default();
|
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
|
||||||
let pdt = PyDateTime {
|
|
||||||
year: 2003, month: 10, day: 1,
|
|
||||||
hour: 0, minute: 0, second: 0,
|
|
||||||
micros: 0, tzo: None
|
|
||||||
};
|
|
||||||
parse_and_assert(pdt, info, "Wed", None, None, false, false,
|
|
||||||
Some(default_rsdate), false, HashMap::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_default32() {
|
|
||||||
let info = ParserInfo::default();
|
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
|
||||||
let pdt = PyDateTime {
|
|
||||||
year: 2003, month: 10, day: 1,
|
|
||||||
hour: 0, minute: 0, second: 0,
|
|
||||||
micros: 0, tzo: None
|
|
||||||
};
|
|
||||||
parse_and_assert(pdt, info, "Wednesday", None, None, false, false,
|
|
||||||
Some(default_rsdate), false, HashMap::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_default33() {
|
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -523,7 +471,7 @@ fn test_parse_default33() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default34() {
|
fn test_parse_default30() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -536,7 +484,7 @@ fn test_parse_default34() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default35() {
|
fn test_parse_default31() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -549,7 +497,7 @@ fn test_parse_default35() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default36() {
|
fn test_parse_default32() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -562,7 +510,7 @@ fn test_parse_default36() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default37() {
|
fn test_parse_default33() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -575,7 +523,7 @@ fn test_parse_default37() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default38() {
|
fn test_parse_default34() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -588,7 +536,7 @@ fn test_parse_default38() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default39() {
|
fn test_parse_default35() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -601,7 +549,7 @@ fn test_parse_default39() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default40() {
|
fn test_parse_default36() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -614,7 +562,7 @@ fn test_parse_default40() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default41() {
|
fn test_parse_default37() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -627,7 +575,7 @@ fn test_parse_default41() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default42() {
|
fn test_parse_default38() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -640,7 +588,7 @@ fn test_parse_default42() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default43() {
|
fn test_parse_default39() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -653,7 +601,7 @@ fn test_parse_default43() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default44() {
|
fn test_parse_default40() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -666,7 +614,7 @@ fn test_parse_default44() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default45() {
|
fn test_parse_default41() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -679,7 +627,7 @@ fn test_parse_default45() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_default46() {
|
fn test_parse_default42() {
|
||||||
let info = ParserInfo::default();
|
let info = ParserInfo::default();
|
||||||
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
let pdt = PyDateTime {
|
let pdt = PyDateTime {
|
||||||
@ -1697,3 +1645,59 @@ fn test_parse_ignoretz7() {
|
|||||||
parse_and_assert(pdt, info, "Tue Apr 4 00:22:12 PDT 1995", None, None, false, false,
|
parse_and_assert(pdt, info, "Tue Apr 4 00:22:12 PDT 1995", None, None, false, false,
|
||||||
None, true, HashMap::new());
|
None, true, HashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn test_parse_default_ignore0() {
|
||||||
|
let info = ParserInfo::default();
|
||||||
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
|
let pdt = PyDateTime {
|
||||||
|
year: 2003, month: 9, day: 25,
|
||||||
|
hour: 10, minute: 36, second: 28,
|
||||||
|
micros: 0, tzo: None
|
||||||
|
};
|
||||||
|
parse_and_assert(pdt, info, "Thu Sep 10:36:28", None, None, false, false,
|
||||||
|
Some(default_rsdate), false, HashMap::new());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn test_parse_default_ignore1() {
|
||||||
|
let info = ParserInfo::default();
|
||||||
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
|
let pdt = PyDateTime {
|
||||||
|
year: 2003, month: 9, day: 25,
|
||||||
|
hour: 10, minute: 36, second: 28,
|
||||||
|
micros: 0, tzo: None
|
||||||
|
};
|
||||||
|
parse_and_assert(pdt, info, "Thu 10:36:28", None, None, false, false,
|
||||||
|
Some(default_rsdate), false, HashMap::new());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn test_parse_default_ignore2() {
|
||||||
|
let info = ParserInfo::default();
|
||||||
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
|
let pdt = PyDateTime {
|
||||||
|
year: 2003, month: 10, day: 1,
|
||||||
|
hour: 0, minute: 0, second: 0,
|
||||||
|
micros: 0, tzo: None
|
||||||
|
};
|
||||||
|
parse_and_assert(pdt, info, "Wed", None, None, false, false,
|
||||||
|
Some(default_rsdate), false, HashMap::new());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn test_parse_default_ignore3() {
|
||||||
|
let info = ParserInfo::default();
|
||||||
|
let default_rsdate = &NaiveDate::from_ymd(2003, 9, 25).and_hms(0, 0, 0);
|
||||||
|
let pdt = PyDateTime {
|
||||||
|
year: 2003, month: 10, day: 1,
|
||||||
|
hour: 0, minute: 0, second: 0,
|
||||||
|
micros: 0, tzo: None
|
||||||
|
};
|
||||||
|
parse_and_assert(pdt, info, "Wednesday", None, None, false, false,
|
||||||
|
Some(default_rsdate), false, HashMap::new());
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user