...I may be an idiot.

pull/12/head
Bradlee Speice 2018-07-02 23:00:45 -04:00
parent c566c5b7c8
commit 2b90bf6ed7
3 changed files with 7 additions and 7 deletions

View File

@ -80,7 +80,7 @@ tests = {
'1994-11-05T08:15:30Z', '1976-07-04T00:01:02Z',
'Tue Apr 4 00:22:12 PDT 1995'
],
'test_fuzzy': [
'test_fuzzy_tzinfo': [
'Today is 25 of September of 2003, exactly at 10:49:41 with timezone -03:00.'
],
'test_parse_default_ignore': [
@ -153,10 +153,10 @@ def test_parse_default_ignore(i, s):
return TEST_PARSE_DEFAULT_IGNORE.format(i=i, d=d, s=s)
def test_fuzzy(i, s):
def test_fuzzy_tzinfo(i, s):
d = parse(s, fuzzy=True)
return TEST_FUZZY.format(i=i, d=d, s=s)
return TEST_FUZZY_TZINFO.format(i=i, d=d, s=s, offset=int(d.tzinfo._offset.total_seconds()))
# Here lies all the ugly junk.
TEST_HEADER = '''
@ -409,14 +409,14 @@ fn test_parse_default_ignore{i}() {{
Some(default_rsdate), false, HashMap::new());
}}\n'''
TEST_FUZZY = '''
TEST_FUZZY_TZINFO = '''
#[test]
fn test_fuzzy{i}() {{
let info = ParserInfo::default();
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
micros: {d.microsecond}, tzo: Some({offset})
}};
parse_fuzzy_and_assert(pdt, None, info, "{s}", None, None, true, false,
None, false, HashMap::new());

View File

@ -718,7 +718,7 @@ impl Parser {
}
i += 1;
} else if !self.info.get_jump(&l[i]) || fuzzy {
} else if !(self.info.get_jump(&l[i]) || fuzzy) {
return Err(ParseError::UnrecognizedToken(l[i].clone()));
} else {
skipped_idxs.push(i);

View File

@ -1740,7 +1740,7 @@ fn test_fuzzy0() {
let pdt = PyDateTime {
year: 2003, month: 9, day: 25,
hour: 10, minute: 49, second: 41,
micros: 0, tzo: None
micros: 0, tzo: Some(-10800)
};
parse_fuzzy_and_assert(pdt, None, info, "Today is 25 of September of 2003, exactly at 10:49:41 with timezone -03:00.", None, None, true, false,
None, false, HashMap::new());