def test_parse_date(): utc = datetime(2012, 12, 2, 13, 0, 0, tzinfo=UTC) raw = datetime(2012, 12, 2, 13, 0, 0) local = timezone['default'].localize(raw) gmt = timezone['gmt'].localize(raw) assert parse_date('2012-12-02 13:00:00') == local assert parse_date('2012-12-02T13:00:00') == local assert parse_date('2012-12-02T13:00:00', 'gmt') == gmt assert parse_date('2012-12-02T13:00:00Z') == utc assert parse_date('2012-12-02T13:00:00Z', 'gmt') == utc
def __init__(self, data): self.id = int(data['ID']) self.date = parse_date(data['post_date']) self.date_gmt = parse_date(data['post_date_gmt']) self.name = data['post_name'] self.modified = parse_date(data['post_modified']) self.modified_gmt = parse_date(data['post_modified_gmt']) self.link = data['post_link'] self.commentlink = data['post_commentlink'] self.mediaurl = data['post_mediaurl'] self.duration = int(data['post_duration'])
def __init__(self, data): self.id = int(data['ID']) self.date = parse_date(data['post_date']) gmt = data.get('post_date_gmt') self.date_gmt = parse_date(gmt, 'gmt') if gmt else None self.name = data['post_name'] self.modified = parse_date(data['post_modified']) gmt = data.get('post_date_gmt') self.modified_gmt = parse_date(gmt, 'gmt') if gmt else None self.link = data['post_link'] self.commentlink = data['post_commentlink'] self.mediaurl = data['post_mediaurl'] self.duration = int(data['post_duration'])
def __init__(self, data): self.id = data['id'] self.podcast = data['podcast'] self.state = int(data['state']) self.type = int(data['type']) self.synced = parse_bool(data['synced']) self.title = data['title'] self.url = data['url'] self.streamurl = data['streamurl'] self.livedate = parse_date(data['livedate']) self.duration = int(data['duration']) self.twittered = parse_bool(data['twittered'])
def test_parse_date(): assert parse_date('2012-12-02 13:00:00') == datetime(2012, 12, 2, 13, 0, 0)
def __init__(self, data): self.event_id = int(data['event_ID']) self.deldate = parse_date(data['deldate'])