From f6a3490e7b2a38f6eab4032c6087df913959c9c0 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Mon, 9 Jul 2012 18:16:44 +0200 Subject: [PATCH 1/6] GitAuthor.date is now a datetime (Issue #54) --- .../GithubObject.AttributeValue.simple.py | 2 +- doc/ReferenceOfClasses.md | 3 ++- github/AuthenticatedUser.py | 4 +--- github/Authorization.py | 6 ++---- github/CommitComment.py | 6 ++---- github/Download.py | 6 ++---- github/Event.py | 4 +--- github/Gist.py | 6 ++---- github/GistComment.py | 6 ++---- github/GistHistoryState.py | 4 +--- github/GitAuthor.py | 8 +++++++- github/GithubObject.py | 18 ++++++++++++++++++ github/Hook.py | 6 ++---- github/Issue.py | 8 +++----- github/IssueComment.py | 6 ++---- github/IssueEvent.py | 4 +--- github/Milestone.py | 4 ++-- github/NamedUser.py | 4 +--- github/Organization.py | 4 +--- github/PullRequest.py | 10 ++++------ github/PullRequestComment.py | 6 ++---- github/Repository.py | 6 +++--- test/GitCommit.py | 8 ++++++-- test/GitTag.py | 5 ++++- 24 files changed, 72 insertions(+), 72 deletions(-) diff --git a/codegen/templates/GithubObject.AttributeValue.simple.py b/codegen/templates/GithubObject.AttributeValue.simple.py index ef252328..77539093 100644 --- a/codegen/templates/GithubObject.AttributeValue.simple.py +++ b/codegen/templates/GithubObject.AttributeValue.simple.py @@ -1 +1 @@ -{% if attribute.type.name == "datetime" %}None if attributes[ "{{ attribute.name }}" ] is None else datetime.datetime.strptime( attributes[ "{{ attribute.name }}" ], "%Y-%m-%dT%H:%M:%SZ" ){% else %}attributes[ "{{ attribute.name }}" ]{% endif %} \ No newline at end of file +{% if attribute.type.name == "datetime" %}self._parseDatetime( attributes[ "{{ attribute.name }}" ] ){% else %}attributes[ "{{ attribute.name }}" ]{% endif %} \ No newline at end of file diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index 485c5348..1b8ea7a9 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -460,7 +460,8 @@ Class `GitAuthor` Attributes ---------- -* `date`: string +* `date`: datetime +* `timezone`: integer * `email`: string * `name`: string diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index f2becfd4..e6247558 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import PaginatedList @@ -619,7 +617,7 @@ class AuthenticatedUser( GithubObject.GithubObject ): self._company = attributes[ "company" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "disk_usage" in attributes: # pragma no branch assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] self._disk_usage = attributes[ "disk_usage" ] diff --git a/github/Authorization.py b/github/Authorization.py index 558d7919..96732f16 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import AuthorizationApplication @@ -116,7 +114,7 @@ class Authorization( GithubObject.GithubObject ): self._app = None if attributes[ "app" ] is None else AuthorizationApplication.AuthorizationApplication( self._requester, attributes[ "app" ], completed = False ) if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] @@ -134,7 +132,7 @@ class Authorization( GithubObject.GithubObject ): self._token = attributes[ "token" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/CommitComment.py b/github/CommitComment.py index a12319da..f55f69a7 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import NamedUser @@ -119,7 +117,7 @@ class CommitComment( GithubObject.GithubObject ): self._commit_id = attributes[ "commit_id" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "html_url" in attributes: # pragma no branch assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] self._html_url = attributes[ "html_url" ] @@ -137,7 +135,7 @@ class CommitComment( GithubObject.GithubObject ): self._position = attributes[ "position" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/Download.py b/github/Download.py index 067706e6..9edfb7cb 100644 --- a/github/Download.py +++ b/github/Download.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject class Download( GithubObject.GithubObject ): @@ -164,7 +162,7 @@ class Download( GithubObject.GithubObject ): self._content_type = attributes[ "content_type" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "description" in attributes: # pragma no branch assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] self._description = attributes[ "description" ] @@ -173,7 +171,7 @@ class Download( GithubObject.GithubObject ): self._download_count = attributes[ "download_count" ] if "expirationdate" in attributes: # pragma no branch assert attributes[ "expirationdate" ] is None or isinstance( attributes[ "expirationdate" ], ( str, unicode ) ), attributes[ "expirationdate" ] - self._expirationdate = None if attributes[ "expirationdate" ] is None else datetime.datetime.strptime( attributes[ "expirationdate" ], "%Y-%m-%dT%H:%M:%S.000Z" ) + self._expirationdate = self._parseDatetime( attributes[ "expirationdate" ] ) if "html_url" in attributes: # pragma no branch assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] self._html_url = attributes[ "html_url" ] diff --git a/github/Event.py b/github/Event.py index c76759c3..13c794b2 100644 --- a/github/Event.py +++ b/github/Event.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import Organization @@ -71,7 +69,7 @@ class Event( GithubObject.BasicGithubObject ): self._actor = None if attributes[ "actor" ] is None else NamedUser.NamedUser( self._requester, attributes[ "actor" ], completed = False ) if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ] self._id = attributes[ "id" ] diff --git a/github/Gist.py b/github/Gist.py index e819429a..03c7b268 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import PaginatedList @@ -220,7 +218,7 @@ class Gist( GithubObject.GithubObject ): self._comments = attributes[ "comments" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "description" in attributes: # pragma no branch assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] self._description = attributes[ "description" ] @@ -262,7 +260,7 @@ class Gist( GithubObject.GithubObject ): self._public = attributes[ "public" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/GistComment.py b/github/GistComment.py index 6cf8dcd3..fa98ea0c 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import NamedUser @@ -86,13 +84,13 @@ class GistComment( GithubObject.GithubObject ): self._body = attributes[ "body" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index e4b88789..018968ea 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import NamedUser @@ -60,7 +58,7 @@ class GistHistoryState( GithubObject.GithubObject ): self._change_status = None if attributes[ "change_status" ] is None else CommitStats.CommitStats( self._requester, attributes[ "change_status" ], completed = False ) if "committed_at" in attributes: # pragma no branch assert attributes[ "committed_at" ] is None or isinstance( attributes[ "committed_at" ], ( str, unicode ) ), attributes[ "committed_at" ] - self._committed_at = None if attributes[ "committed_at" ] is None else datetime.datetime.strptime( attributes[ "committed_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._committed_at = self._parseDatetime( attributes[ "committed_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/GitAuthor.py b/github/GitAuthor.py index c997b499..87c2cb56 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -21,6 +21,10 @@ class GitAuthor( GithubObject.BasicGithubObject ): def date( self ): return self._NoneIfNotSet( self._date ) + @property + def timezone( self ): + return self._NoneIfNotSet( self._timezone ) + @property def email( self ): return self._NoneIfNotSet( self._email ) @@ -31,13 +35,15 @@ class GitAuthor( GithubObject.BasicGithubObject ): def _initAttributes( self ): self._date = GithubObject.NotSet + self._timezone = GithubObject.NotSet self._email = GithubObject.NotSet self._name = GithubObject.NotSet def _useAttributes( self, attributes ): if "date" in attributes: # pragma no branch assert attributes[ "date" ] is None or isinstance( attributes[ "date" ], ( str, unicode ) ), attributes[ "date" ] - self._date = attributes[ "date" ] + self._date = self._parseDatetime( attributes[ "date" ] ) + self._timezone = self._parseTimezone( attributes[ "date" ] ) if "email" in attributes: # pragma no branch assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] self._email = attributes[ "email" ] diff --git a/github/GithubObject.py b/github/GithubObject.py index 9ce17990..ec187800 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -11,6 +11,8 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . +import datetime + import GithubException class _NotSetType: @@ -34,6 +36,22 @@ class BasicGithubObject( object ): else: return value + @staticmethod + def _parseDatetime( s ): + if s is None: + return None + elif len( s ) == 24: + return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" ) + elif len( s ) == 25: + return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + else: + return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" ) + + @staticmethod + def _parseTimezone( s ): + assert len( s ) == 25 + return int( s[ 19 : 22 ] ) + int( s[ 23 : 25 ] ) / 60. + class GithubObject( BasicGithubObject ): def __init__( self, requester, attributes, completed ): BasicGithubObject.__init__( self, requester, attributes, completed ) diff --git a/github/Hook.py b/github/Hook.py index 22725933..74de282c 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import HookResponse @@ -129,7 +127,7 @@ class Hook( GithubObject.GithubObject ): self._config = attributes[ "config" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "events" in attributes: # pragma no branch assert attributes[ "events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ] self._events = attributes[ "events" ] @@ -144,7 +142,7 @@ class Hook( GithubObject.GithubObject ): self._name = attributes[ "name" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/Issue.py b/github/Issue.py index aeb7c0c6..333facdc 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import PaginatedList @@ -281,7 +279,7 @@ class Issue( GithubObject.GithubObject ): self._body = attributes[ "body" ] if "closed_at" in attributes: # pragma no branch assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ] - self._closed_at = None if attributes[ "closed_at" ] is None else datetime.datetime.strptime( attributes[ "closed_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._closed_at = self._parseDatetime( attributes[ "closed_at" ] ) if "closed_by" in attributes: # pragma no branch assert attributes[ "closed_by" ] is None or isinstance( attributes[ "closed_by" ], dict ), attributes[ "closed_by" ] self._closed_by = None if attributes[ "closed_by" ] is None else NamedUser.NamedUser( self._requester, attributes[ "closed_by" ], completed = False ) @@ -290,7 +288,7 @@ class Issue( GithubObject.GithubObject ): self._comments = attributes[ "comments" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "html_url" in attributes: # pragma no branch assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] self._html_url = attributes[ "html_url" ] @@ -323,7 +321,7 @@ class Issue( GithubObject.GithubObject ): self._title = attributes[ "title" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/IssueComment.py b/github/IssueComment.py index de363fea..396e82f1 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import NamedUser @@ -86,13 +84,13 @@ class IssueComment( GithubObject.GithubObject ): self._body = attributes[ "body" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/IssueEvent.py b/github/IssueEvent.py index 60b816c5..0b930da0 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import Issue @@ -75,7 +73,7 @@ class IssueEvent( GithubObject.GithubObject ): self._commit_id = attributes[ "commit_id" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "event" in attributes: # pragma no branch assert attributes[ "event" ] is None or isinstance( attributes[ "event" ], ( str, unicode ) ), attributes[ "event" ] self._event = attributes[ "event" ] diff --git a/github/Milestone.py b/github/Milestone.py index c546910e..0682336b 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -145,7 +145,7 @@ class Milestone( GithubObject.GithubObject ): self._closed_issues = attributes[ "closed_issues" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "creator" in attributes: # pragma no branch assert attributes[ "creator" ] is None or isinstance( attributes[ "creator" ], dict ), attributes[ "creator" ] self._creator = None if attributes[ "creator" ] is None else NamedUser.NamedUser( self._requester, attributes[ "creator" ], completed = False ) @@ -154,7 +154,7 @@ class Milestone( GithubObject.GithubObject ): self._description = attributes[ "description" ] if "due_on" in attributes: # pragma no branch assert attributes[ "due_on" ] is None or isinstance( attributes[ "due_on" ], ( str, unicode ) ), attributes[ "due_on" ] - self._due_on = None if attributes[ "due_on" ] is None else datetime.datetime.strptime( attributes[ "due_on" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._due_on = self._parseDatetime( attributes[ "due_on" ] ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] diff --git a/github/NamedUser.py b/github/NamedUser.py index 8a1e4f12..f6f806ca 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import PaginatedList @@ -383,7 +381,7 @@ class NamedUser( GithubObject.GithubObject ): self._contributions = attributes[ "contributions" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "disk_usage" in attributes: # pragma no branch assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] self._disk_usage = attributes[ "disk_usage" ] diff --git a/github/Organization.py b/github/Organization.py index 0ab91c40..2ca1af19 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import PaginatedList @@ -425,7 +423,7 @@ class Organization( GithubObject.GithubObject ): self._company = attributes[ "company" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "disk_usage" in attributes: # pragma no branch assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] self._disk_usage = attributes[ "disk_usage" ] diff --git a/github/PullRequest.py b/github/PullRequest.py index cf626f56..52b788cb 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import PaginatedList @@ -312,7 +310,7 @@ class PullRequest( GithubObject.GithubObject ): self._changed_files = attributes[ "changed_files" ] if "closed_at" in attributes: # pragma no branch assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ] - self._closed_at = None if attributes[ "closed_at" ] is None else datetime.datetime.strptime( attributes[ "closed_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._closed_at = self._parseDatetime( attributes[ "closed_at" ] ) if "comments" in attributes: # pragma no branch assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ] self._comments = attributes[ "comments" ] @@ -321,7 +319,7 @@ class PullRequest( GithubObject.GithubObject ): self._commits = attributes[ "commits" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "deletions" in attributes: # pragma no branch assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ] self._deletions = attributes[ "deletions" ] @@ -348,7 +346,7 @@ class PullRequest( GithubObject.GithubObject ): self._merged = attributes[ "merged" ] if "merged_at" in attributes: # pragma no branch assert attributes[ "merged_at" ] is None or isinstance( attributes[ "merged_at" ], ( str, unicode ) ), attributes[ "merged_at" ] - self._merged_at = None if attributes[ "merged_at" ] is None else datetime.datetime.strptime( attributes[ "merged_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._merged_at = self._parseDatetime( attributes[ "merged_at" ] ) if "merged_by" in attributes: # pragma no branch assert attributes[ "merged_by" ] is None or isinstance( attributes[ "merged_by" ], dict ), attributes[ "merged_by" ] self._merged_by = None if attributes[ "merged_by" ] is None else NamedUser.NamedUser( self._requester, attributes[ "merged_by" ], completed = False ) @@ -369,7 +367,7 @@ class PullRequest( GithubObject.GithubObject ): self._title = attributes[ "title" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index c0ca23c6..0bc86f2b 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -14,8 +14,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import datetime - import GithubObject import NamedUser @@ -119,7 +117,7 @@ class PullRequestComment( GithubObject.GithubObject ): self._commit_id = attributes[ "commit_id" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] @@ -137,7 +135,7 @@ class PullRequestComment( GithubObject.GithubObject ): self._position = attributes[ "position" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/github/Repository.py b/github/Repository.py index 32237a9f..f39f2c6a 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -1059,7 +1059,7 @@ class Repository( GithubObject.GithubObject ): self._clone_url = attributes[ "clone_url" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._created_at = self._parseDatetime( attributes[ "created_at" ] ) if "description" in attributes: # pragma no branch assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] self._description = attributes[ "description" ] @@ -1122,7 +1122,7 @@ class Repository( GithubObject.GithubObject ): self._private = attributes[ "private" ] if "pushed_at" in attributes: # pragma no branch assert attributes[ "pushed_at" ] is None or isinstance( attributes[ "pushed_at" ], ( str, unicode ) ), attributes[ "pushed_at" ] - self._pushed_at = None if attributes[ "pushed_at" ] is None else datetime.datetime.strptime( attributes[ "pushed_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._pushed_at = self._parseDatetime( attributes[ "pushed_at" ] ) if "size" in attributes: # pragma no branch assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] self._size = attributes[ "size" ] @@ -1137,7 +1137,7 @@ class Repository( GithubObject.GithubObject ): self._svn_url = attributes[ "svn_url" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) + self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] diff --git a/test/GitCommit.py b/test/GitCommit.py index 31617775..220ae0b9 100644 --- a/test/GitCommit.py +++ b/test/GitCommit.py @@ -11,6 +11,8 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . +import datetime + import Framework class GitCommit( Framework.TestCase ): @@ -21,10 +23,12 @@ class GitCommit( Framework.TestCase ): def testAttributes( self ): self.assertEqual( self.commit.author.name, "Vincent Jacques" ) self.assertEqual( self.commit.author.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.commit.author.date, "2012-04-17T10:55:16-07:00" ) + self.assertEqual( self.commit.author.date, datetime.datetime( 2012, 4, 17, 10, 55, 16 ) ) + self.assertEqual( self.commit.author.timezone, -7 ) self.assertEqual( self.commit.committer.name, "Vincent Jacques" ) self.assertEqual( self.commit.committer.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.commit.committer.date, "2012-04-17T10:55:16-07:00" ) + self.assertEqual( self.commit.committer.date, datetime.datetime( 2012, 4, 17, 10, 55, 16 ) ) + self.assertEqual( self.commit.committer.timezone, -7 ) self.assertEqual( self.commit.message, "Merge branch 'develop'\n" ) self.assertEqual( len( self.commit.parents ), 2 ) self.assertEqual( self.commit.parents[ 0 ].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d" ) diff --git a/test/GitTag.py b/test/GitTag.py index 60ded04f..c05809fa 100644 --- a/test/GitTag.py +++ b/test/GitTag.py @@ -11,6 +11,8 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . +import datetime + import Framework class GitTag( Framework.TestCase ): @@ -25,7 +27,8 @@ class GitTag( Framework.TestCase ): self.assertEqual( self.tag.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495" ) self.assertEqual( self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c" ) self.assertEqual( self.tag.tag, "v0.6" ) - self.assertEqual( self.tag.tagger.date, "2012-05-10T11:14:15-07:00" ) + self.assertEqual( self.tag.tagger.date, datetime.datetime( 2012, 5, 10, 11, 14, 15 ) ) + self.assertEqual( self.tag.tagger.timezone, -7 ) self.assertEqual( self.tag.tagger.email, "vincent@vincent-jacques.net" ) self.assertEqual( self.tag.tagger.name, "Vincent Jacques" ) self.assertEqual( self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c" ) From 4e85f4178acb586ad22fbac6880aa47b03cab5e9 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Tue, 10 Jul 2012 18:09:35 +0200 Subject: [PATCH 2/6] Add tests about issue #54, according to comments by @bilderbuchi --- doc/ReferenceOfClasses.md | 74 +++++++++---------- github/GithubObject.py | 2 +- test/GitCommit.py | 4 +- test/GitTag.py | 2 +- test/IntegrationTest.py | 1 + test/Issue54.py | 39 ++++++++++ test/ReplayData/Issue54.setUp.txt | 10 +++ ...ssue54.testNegativeHalfIntegerTimezone.txt | 5 ++ .../Issue54.testNegativeIntegerTimezone.txt | 5 ++ ...ssue54.testPositiveHalfIntegerTimezone.txt | 5 ++ .../Issue54.testPositiveIntegerTimezone.txt | 5 ++ 11 files changed, 111 insertions(+), 41 deletions(-) create mode 100644 test/Issue54.py create mode 100644 test/ReplayData/Issue54.setUp.txt create mode 100644 test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt create mode 100644 test/ReplayData/Issue54.testNegativeIntegerTimezone.txt create mode 100644 test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt create mode 100644 test/ReplayData/Issue54.testPositiveIntegerTimezone.txt diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index 1b8ea7a9..ae3cb41b 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -56,7 +56,7 @@ Attributes * `blog`: string * `collaborators`: integer * `company`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `disk_usage`: integer * `email`: string * `followers`: integer @@ -190,13 +190,13 @@ Class `Authorization` Attributes ---------- * `app`: `AuthorizationApplication` -* `created_at`: datetime +* `created_at`: datetime.datetime * `id`: integer * `note`: string * `note_url`: string * `scopes`: list of string * `token`: string -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string Deletion @@ -258,13 +258,13 @@ Attributes ---------- * `body`: string * `commit_id`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `html_url`: string * `id`: integer * `line`: integer * `path`: string * `position`: integer -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -313,10 +313,10 @@ Attributes * `acl`: string * `bucket`: string * `content_type`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `description`: string * `download_count`: integer -* `expirationdate`: datetime +* `expirationdate`: datetime.datetime * `html_url`: string * `id`: integer * `mime_type`: string @@ -340,7 +340,7 @@ Class `Event` Attributes ---------- * `actor`: `NamedUser` -* `created_at`: datetime +* `created_at`: datetime.datetime * `id`: string * `org`: `Organization` * `payload`: dict @@ -369,7 +369,7 @@ Class `Gist` Attributes ---------- * `comments`: integer -* `created_at`: datetime +* `created_at`: datetime.datetime * `description`: string * `files`: dict of string to `GistFile` * `fork_of`: `Gist` @@ -380,7 +380,7 @@ Attributes * `html_url`: string * `id`: string * `public`: bool -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -418,9 +418,9 @@ Class `GistComment` Attributes ---------- * `body`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `id`: integer -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -450,7 +450,7 @@ Class `GistHistoryState` Attributes ---------- * `change_status`: `CommitStats` -* `committed_at`: datetime +* `committed_at`: datetime.datetime * `url`: string * `user`: `NamedUser` * `version`: string @@ -460,8 +460,8 @@ Class `GitAuthor` Attributes ---------- -* `date`: datetime -* `timezone`: integer +* `date`: datetime.datetime +* `timezone`: datetime.timedelta * `email`: string * `name`: string @@ -557,12 +557,12 @@ Attributes ---------- * `active`: bool * `config`: dict -* `created_at`: datetime +* `created_at`: datetime.datetime * `events`: list of string * `id`: integer * `last_response`: `HookResponse` * `name`: string -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string Deletion @@ -599,10 +599,10 @@ Attributes ---------- * `assignee`: `NamedUser` * `body`: string -* `closed_at`: datetime +* `closed_at`: datetime.datetime * `closed_by`: `NamedUser` * `comments`: integer -* `created_at`: datetime +* `created_at`: datetime.datetime * `html_url`: string * `id`: integer * `labels`: list of `Label` @@ -612,7 +612,7 @@ Attributes * `repository`: `Repository` * `state`: string * `title`: string -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -655,9 +655,9 @@ Class `IssueComment` Attributes ---------- * `body`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `id`: integer -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -677,7 +677,7 @@ Attributes ---------- * `actor`: `NamedUser` * `commit_id`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `event`: string * `id`: integer * `issue`: `Issue` @@ -717,10 +717,10 @@ Class `Milestone` Attributes ---------- * `closed_issues`: integer -* `created_at`: datetime +* `created_at`: datetime.datetime * `creator`: `NamedUser` * `description`: string -* `due_on`: datetime +* `due_on`: datetime.datetime * `id`: integer * `number`: integer * `open_issues`: integer @@ -755,7 +755,7 @@ Attributes * `collaborators`: integer * `company`: string * `contributions`: integer -* `created_at`: datetime +* `created_at`: datetime.datetime * `disk_usage`: integer * `email`: string * `followers`: integer @@ -824,7 +824,7 @@ Attributes * `blog`: string * `collaborators`: integer * `company`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `disk_usage`: integer * `email`: string * `followers`: integer @@ -935,10 +935,10 @@ Attributes * `base`: `PullRequestPart` * `body`: string * `changed_files`: integer -* `closed_at`: datetime +* `closed_at`: datetime.datetime * `comments`: integer * `commits`: integer -* `created_at`: datetime +* `created_at`: datetime.datetime * `deletions`: integer * `diff_url`: string * `head`: `PullRequestPart` @@ -947,14 +947,14 @@ Attributes * `issue_url`: string * `mergeable`: bool * `merged`: bool -* `merged_at`: datetime +* `merged_at`: datetime.datetime * `merged_by`: `NamedUser` * `number`: integer * `patch_url`: string * `review_comments`: integer * `state`: string * `title`: string -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -997,13 +997,13 @@ Attributes ---------- * `body`: string * `commit_id`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `id`: integer * `original_commit_id`: string * `original_position`: integer * `path`: string * `position`: integer -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `user`: `NamedUser` @@ -1042,7 +1042,7 @@ Class `Repository` Attributes ---------- * `clone_url`: string -* `created_at`: datetime +* `created_at`: datetime.datetime * `description`: string * `fork`: bool * `forks`: integer @@ -1063,12 +1063,12 @@ Attributes * `parent`: `Repository` * `permissions`: `Permissions` * `private`: bool -* `pushed_at`: datetime +* `pushed_at`: datetime.datetime * `size`: integer * `source`: `Repository` * `ssh_url`: string * `svn_url`: string -* `updated_at`: datetime +* `updated_at`: datetime.datetime * `url`: string * `watchers`: integer @@ -1207,7 +1207,7 @@ Issues * `labels`: list of `Label` * `sort`: string * `direction`: string - * `since`: datetime + * `since`: datetime.datetime * `legacy_search_issues( state, keyword )`: iterator of `Issue` * `state`: "open" or "closed" * `keyword`: string diff --git a/github/GithubObject.py b/github/GithubObject.py index ec187800..10d96d5c 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -50,7 +50,7 @@ class BasicGithubObject( object ): @staticmethod def _parseTimezone( s ): assert len( s ) == 25 - return int( s[ 19 : 22 ] ) + int( s[ 23 : 25 ] ) / 60. + return ( -1 if s[ 19 ] == '-' else 1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) ) class GithubObject( BasicGithubObject ): def __init__( self, requester, attributes, completed ): diff --git a/test/GitCommit.py b/test/GitCommit.py index 220ae0b9..961e9f17 100644 --- a/test/GitCommit.py +++ b/test/GitCommit.py @@ -24,11 +24,11 @@ class GitCommit( Framework.TestCase ): self.assertEqual( self.commit.author.name, "Vincent Jacques" ) self.assertEqual( self.commit.author.email, "vincent@vincent-jacques.net" ) self.assertEqual( self.commit.author.date, datetime.datetime( 2012, 4, 17, 10, 55, 16 ) ) - self.assertEqual( self.commit.author.timezone, -7 ) + self.assertEqual( self.commit.author.timezone, datetime.timedelta( hours = -7 ) ) self.assertEqual( self.commit.committer.name, "Vincent Jacques" ) self.assertEqual( self.commit.committer.email, "vincent@vincent-jacques.net" ) self.assertEqual( self.commit.committer.date, datetime.datetime( 2012, 4, 17, 10, 55, 16 ) ) - self.assertEqual( self.commit.committer.timezone, -7 ) + self.assertEqual( self.commit.committer.timezone, datetime.timedelta( hours = -7 ) ) self.assertEqual( self.commit.message, "Merge branch 'develop'\n" ) self.assertEqual( len( self.commit.parents ), 2 ) self.assertEqual( self.commit.parents[ 0 ].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d" ) diff --git a/test/GitTag.py b/test/GitTag.py index c05809fa..2518ef06 100644 --- a/test/GitTag.py +++ b/test/GitTag.py @@ -28,7 +28,7 @@ class GitTag( Framework.TestCase ): self.assertEqual( self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c" ) self.assertEqual( self.tag.tag, "v0.6" ) self.assertEqual( self.tag.tagger.date, datetime.datetime( 2012, 5, 10, 11, 14, 15 ) ) - self.assertEqual( self.tag.tagger.timezone, -7 ) + self.assertEqual( self.tag.tagger.timezone, datetime.timedelta( hours = -7 ) ) self.assertEqual( self.tag.tagger.email, "vincent@vincent-jacques.net" ) self.assertEqual( self.tag.tagger.name, "Vincent Jacques" ) self.assertEqual( self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c" ) diff --git a/test/IntegrationTest.py b/test/IntegrationTest.py index a2d966b6..4279eb38 100755 --- a/test/IntegrationTest.py +++ b/test/IntegrationTest.py @@ -52,6 +52,7 @@ from UserKey import * from PaginatedList import * from Issue33 import * from Issue50 import * +from Issue54 import * from Exceptions import * Framework.main() diff --git a/test/Issue54.py b/test/Issue54.py new file mode 100644 index 00000000..480728c0 --- /dev/null +++ b/test/Issue54.py @@ -0,0 +1,39 @@ +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import datetime + +import Framework + +class Issue54( Framework.TestCase ): + def setUp( self ): + Framework.TestCase.setUp( self ) + self.repo = self.g.get_user().get_repo( "PyGithub" ) + + def testPositiveIntegerTimezone( self ): + commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) + self.assertEqual( commit.author.timezone, datetime.timedelta( hours = 7 ) ) + + def testNegativeIntegerTimezone( self ): + commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) + self.assertEqual( commit.author.timezone, datetime.timedelta( hours = -7 ) ) + + # I was not able to find a real commit with an half integer timezone, so I *forged* the associated responses from Github. + # I *hope* they are what Github would send in that case + def testPositiveHalfIntegerTimezone( self ): + commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) + self.assertEqual( commit.author.timezone, datetime.timedelta( hours = 7, minutes = 30 ) ) + + def testNegativeHalfIntegerTimezone( self ): + commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) + self.assertEqual( commit.author.timezone, datetime.timedelta( hours = -7, minutes = -30 ) ) diff --git a/test/ReplayData/Issue54.setUp.txt b/test/ReplayData/Issue54.setUp.txt new file mode 100644 index 00000000..24c3651d --- /dev/null +++ b/test/ReplayData/Issue54.setUp.txt @@ -0,0 +1,10 @@ +GET /user {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4968'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"55f0187d26f5ca2e7103006d9837865c"'), ('date', 'Thu, 10 May 2012 19:05:23 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"total_private_repos":5,"html_url":"https://github.com/jacquev6","type":"User","url":"https://api.github.com/users/jacquev6","owned_private_repos":5,"disk_usage":16676,"plan":{"private_repos":5,"collaborators":1,"space":614400,"name":"micro"},"public_gists":1,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","blog":"http://vincent-jacques.net","private_gists":5,"login":"jacquev6","public_repos":10,"email":"vincent@vincent-jacques.net","collaborators":0,"created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","hireable":false,"followers":13,"following":24,"name":"Vincent Jacques","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","bio":"","id":327146} + +GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"72a84ed8ad0d83f6a4c09dcd388c20a1"'), ('date', 'Thu, 10 May 2012 19:05:27 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"homepage":"http://vincent-jacques.net/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_downloads":true,"watchers":13,"permissions":{"admin":true,"pull":true,"push":true},"mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":2,"language":"Python","size":196,"description":"Python library implementing the full Github API v3","git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"created_at":"2012-02-25T12:53:47Z","open_issues":15,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146},"name":"PyGithub","pushed_at":"2012-05-10T18:49:21Z","id":3544490,"ssh_url":"git@github.com:jacquev6/PyGithub.git","updated_at":"2012-05-10T18:49:21Z"} + diff --git a/test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt b/test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt new file mode 100644 index 00000000..0e51b344 --- /dev/null +++ b/test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt @@ -0,0 +1,5 @@ +GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:30","name":"Vincent Jacques"}} + diff --git a/test/ReplayData/Issue54.testNegativeIntegerTimezone.txt b/test/ReplayData/Issue54.testNegativeIntegerTimezone.txt new file mode 100644 index 00000000..9a2b9e94 --- /dev/null +++ b/test/ReplayData/Issue54.testNegativeIntegerTimezone.txt @@ -0,0 +1,5 @@ +GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"}} + diff --git a/test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt b/test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt new file mode 100644 index 00000000..d35c8dcd --- /dev/null +++ b/test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt @@ -0,0 +1,5 @@ +GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16+07:30","name":"Vincent Jacques"}} + diff --git a/test/ReplayData/Issue54.testPositiveIntegerTimezone.txt b/test/ReplayData/Issue54.testPositiveIntegerTimezone.txt new file mode 100644 index 00000000..d614219b --- /dev/null +++ b/test/ReplayData/Issue54.testPositiveIntegerTimezone.txt @@ -0,0 +1,5 @@ +GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16+07:00","name":"Vincent Jacques"}} + From 5cbee7346f1a70e0ddd6769d0f7cfbf4199668a2 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Tue, 10 Jul 2012 20:37:49 +0100 Subject: [PATCH 3/6] Small clean-up + type fixes --- doc/ReferenceOfApis.md | 6 +++--- doc/ReferenceOfClasses.md | 2 +- github/Github.py | 9 ++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/ReferenceOfApis.md b/doc/ReferenceOfApis.md index ce01775c..e44c9182 100644 --- a/doc/ReferenceOfApis.md +++ b/doc/ReferenceOfApis.md @@ -62,15 +62,15 @@ API `/legacy/issues/search/:owner/:repository/:state/:keyword` * GET: `Repository.search_issues` API `/legacy/repos/search/:keyword` -============================================================== +=================================== * GET: `Github.search_repos` API `/legacy/user/search/:keyword` -============================================================== +================================== * GET: `Github.search_users` API `/legacy/user/email/:email` -============================================================== +=============================== * GET: `Github.search_user_by_email` API `/networks/:user/:repo/events` diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index 485c5348..bbf95b53 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -27,7 +27,7 @@ Methods * `get_user( login )`: `NamedUser` * `get_organization( login )`: `Organization` * `get_gist( id )`: `Gist` - * `id`: integer + * `id`: string * `get_gists()`: iterator of `Gist` * `search_repos( keyword )`: iterator of `Repository` * `legacy_search_repos( keyword, [language] )`: iterator of `Repository` diff --git a/github/Github.py b/github/Github.py index 3b388512..7aaedc8a 100644 --- a/github/Github.py +++ b/github/Github.py @@ -31,8 +31,9 @@ class Github( object ): def rate_limiting( self ): return self.__requester.rate_limiting - def get_user( self, login = None ): - if login is None: + def get_user( self, login = GithubObject.NotSet ): + assert login is GithubObject.NotSet or isinstance( login, ( str, unicode ) ), login + if login is GithubObject.NotSet: return AuthenticatedUser.AuthenticatedUser( self.__requester, { "url": "https://api.github.com/user" }, completed = False ) else: headers, data = self.__requester.requestAndCheck( @@ -44,6 +45,7 @@ class Github( object ): return NamedUser.NamedUser( self.__requester, data, completed = True ) def get_organization( self, login ): + assert isinstance( login, ( str, unicode ) ), login headers, data = self.__requester.requestAndCheck( "GET", "https://api.github.com/orgs/" + login, @@ -53,9 +55,10 @@ class Github( object ): return Organization.Organization( self.__requester, data, completed = True ) def get_gist( self, id ): + assert isinstance( id, ( str, unicode ) ), id headers, data = self.__requester.requestAndCheck( "GET", - "https://api.github.com/gists/" + str( id ), + "https://api.github.com/gists/" + id, None, None ) From 002b7fbdc15b6ab7f7ba7ae163b9061de8edc70c Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Fri, 13 Jul 2012 13:49:39 +0200 Subject: [PATCH 4/6] Fix(?) problem with documentation install path (Issue #48) --- publish.sh | 14 ++++++++++++++ setup.py | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 publish.sh diff --git a/publish.sh b/publish.sh new file mode 100644 index 00000000..639cf20e --- /dev/null +++ b/publish.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +cp -r *.md doc COPYING* github + +python setup.py sdist + +rm -rf github/*.md github/doc github/COPYING* + +echo "Type 'yes' if everything is right and you want to publish the package" +read yes +if [ "x$yes" == "xyes" ] +then + python setup.py upload +fi diff --git a/setup.py b/setup.py index 0dbac04a..668a8ed2 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ setup( "github", ], package_data = { - "github": [ "../ReadMe.md", "../COPYING*", "../doc/*.md" ] + "github": [ "ReadMe.md", "COPYING*", "doc/*.md" ] }, classifiers = [ "Development Status :: 5 - Production/Stable", From 478c0aaa2b8020e7c893d3d93d7c6cbcff942650 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Fri, 13 Jul 2012 18:13:43 +0200 Subject: [PATCH 5/6] Implement markdown rendering (Issue #56) --- doc/ReferenceOfApis.md | 8 ++++++ doc/ReferenceOfClasses.md | 3 +++ github/Github.py | 17 ++++++++++++ github/Requester.py | 3 ++- test/IntegrationTest.py | 1 + test/Markdown.py | 26 +++++++++++++++++++ test/ReplayData/Markdown.setUp.txt | 10 +++++++ ...kdown.testRenderGithubFlavoredMarkdown.txt | 5 ++++ .../Markdown.testRenderMarkdown.txt | 5 ++++ 9 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 test/Markdown.py create mode 100644 test/ReplayData/Markdown.setUp.txt create mode 100644 test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt create mode 100644 test/ReplayData/Markdown.testRenderMarkdown.txt diff --git a/doc/ReferenceOfApis.md b/doc/ReferenceOfApis.md index ce01775c..29f1b18a 100644 --- a/doc/ReferenceOfApis.md +++ b/doc/ReferenceOfApis.md @@ -73,6 +73,14 @@ API `/legacy/user/email/:email` ============================================================== * GET: `Github.search_user_by_email` +API `/markdown` +=============== +* POST: `Github.render_markdown` + +API `/markdown/raw` +=================== +* POST: see API `/markdown` + API `/networks/:user/:repo/events` ================================== * GET: `Repository.get_network_events` diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index 485c5348..62563acc 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -37,6 +37,9 @@ Methods * `keyword`: string * `legacy_search_user_by_email( email )`: `NamedUser` * `email`: string +* `render_markdown( text, [context] )`: string + * `text`: string + * `context`: `Repository` Class `GithubException` ======================= diff --git a/github/Github.py b/github/Github.py index 3b388512..0c74e156 100644 --- a/github/Github.py +++ b/github/Github.py @@ -103,3 +103,20 @@ class Github( object ): None ) return NamedUser.NamedUser( self.__requester, Legacy.convertUser( data[ "user" ] ), completed = False ) + + def render_markdown( self, text, context = GithubObject.NotSet ): + assert isinstance( text, ( str, unicode ) ), text + assert context is GithubObject.NotSet or isinstance( context, Repository.Repository ), context + post_parameters = { + "text": text + } + if context is not GithubObject.NotSet: + post_parameters[ "mode" ] = "gfm" + post_parameters[ "context" ] = context._identity + status, headers, data = self.__requester.requestRaw( + "POST", + "https://api.github.com/markdown", + None, + post_parameters + ) + return data diff --git a/github/Requester.py b/github/Requester.py index 6bce409f..d6aa41ff 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -36,6 +36,7 @@ class Requester: def requestAndCheck( self, verb, url, parameters, input ): status, headers, output = self.requestRaw( verb, url, parameters, input ) + output = self.__structuredFromJson( output ) if status >= 400: raise GithubException.GithubException( status, output ) return headers, output @@ -60,7 +61,7 @@ class Requester: status = response.status headers = dict( response.getheaders() ) - output = self.__structuredFromJson( response.read() ) + output = response.read() cnx.close() diff --git a/test/IntegrationTest.py b/test/IntegrationTest.py index a2d966b6..49672c8f 100755 --- a/test/IntegrationTest.py +++ b/test/IntegrationTest.py @@ -48,6 +48,7 @@ from RepositoryKey import * from Tag import * from Team import * from UserKey import * +from Markdown import * from PaginatedList import * from Issue33 import * diff --git a/test/Markdown.py b/test/Markdown.py new file mode 100644 index 00000000..971fa167 --- /dev/null +++ b/test/Markdown.py @@ -0,0 +1,26 @@ +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +class Markdown( Framework.TestCase ): + def setUp( self ): + Framework.TestCase.setUp( self ) + self.text = "MyTitle\n=======\n\nIssue #1" + self.repo = self.g.get_user().get_repo( "PyGithub" ) + + def testRenderMarkdown( self ): + self.assertEqual( self.g.render_markdown( self.text ), '

MyTitle

Issue #1

' ) + + def testRenderGithubFlavoredMarkdown( self ): + self.assertEqual( self.g.render_markdown( self.text, self.repo ), '

MyTitle

Issue #1

' ) diff --git a/test/ReplayData/Markdown.setUp.txt b/test/ReplayData/Markdown.setUp.txt new file mode 100644 index 00000000..24cca469 --- /dev/null +++ b/test/ReplayData/Markdown.setUp.txt @@ -0,0 +1,10 @@ +GET /user {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('content-length', '801'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4987'), ('server', 'nginx/1.0.13'), ('last-modified', 'Mon, 09 Jul 2012 06:49:53 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bd2b9dfc8ba65f7665102d6245a1593"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 11:59:58 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"disk_usage":13720,"public_repos":11,"type":"User","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","total_private_repos":3,"collaborators":0,"hireable":false,"login":"jacquev6","owned_private_repos":3,"public_gists":3,"email":"vincent@vincent-jacques.net","bio":"","private_gists":5,"created_at":"2010-07-09T06:10:06Z","blog":"http://vincent-jacques.net","following":26,"location":"Paris, France","followers":13,"name":"Vincent Jacques","company":"Criteo","plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"html_url":"https://github.com/jacquev6","id":327146,"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225"} + +GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1154'), ('server', 'nginx/1.0.13'), ('last-modified', 'Thu, 12 Jul 2012 18:10:45 GMT'), ('connection', 'keep-alive'), ('etag', '"7db49a096161f262ffd7e0545292f4c3"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 11:59:59 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"svn_url":"https://github.com/jacquev6/PyGithub","created_at":"2012-02-25T12:53:47Z","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"login":"jacquev6","url":"https://api.github.com/users/jacquev6"},"full_name":"jacquev6/PyGithub","has_wiki":false,"watchers":43,"git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","pushed_at":"2012-07-11T11:29:24Z","updated_at":"2012-07-12T18:10:45Z","permissions":{"pull":true,"push":true,"admin":true},"open_issues":11,"forks":7,"clone_url":"https://github.com/jacquev6/PyGithub.git","ssh_url":"git@github.com:jacquev6/PyGithub.git","homepage":"http://vincent-jacques.net/PyGithub","size":160,"fork":false,"master_branch":"master","mirror_url":null,"has_issues":true,"name":"PyGithub","has_downloads":true,"description":"Python library implementing the full Github API v3","private":false,"id":3544490,"language":"Python","url":"https://api.github.com/repos/jacquev6/PyGithub"} + diff --git a/test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt b/test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt new file mode 100644 index 00000000..7055d88a --- /dev/null +++ b/test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt @@ -0,0 +1,5 @@ +POST /markdown {'Authorization': 'Basic login_and_password_removed'} {"text": "MyTitle\n=======\n\nIssue #1", "mode": "gfm", "context": "jacquev6/PyGithub"} +200 +[('status', '200 OK'), ('content-length', '150'), ('x-ratelimit-remaining', '4988'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"63251bf7dbb58f62c59ae39bb72c7a38"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 13 Jul 2012 11:59:58 GMT'), ('content-type', 'text/html;charset=utf-8')] +

MyTitle

Issue #1

+ diff --git a/test/ReplayData/Markdown.testRenderMarkdown.txt b/test/ReplayData/Markdown.testRenderMarkdown.txt new file mode 100644 index 00000000..6c72da7c --- /dev/null +++ b/test/ReplayData/Markdown.testRenderMarkdown.txt @@ -0,0 +1,5 @@ +POST /markdown {'Authorization': 'Basic login_and_password_removed'} {"text": "MyTitle\n=======\n\nIssue #1"} +200 +[('status', '200 OK'), ('content-length', '133'), ('x-ratelimit-remaining', '4985'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4cb17c0ebe3cc45c1a7f27d4d0850c54"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 13 Jul 2012 11:59:59 GMT'), ('content-type', 'text/html;charset=utf-8')] +

MyTitle

Issue #1

+ From 0218adc5648ef134ef2f47b6b0b1b4c27e27878d Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Fri, 13 Jul 2012 21:11:17 +0200 Subject: [PATCH 6/6] Finaly remove GitAuthor.timezone See https://github.com/jacquev6/PyGithub/issues/54#issuecomment-6972414 --- doc/ReferenceOfClasses.md | 1 - github/GitAuthor.py | 6 ----- github/GithubObject.py | 7 +----- test/Issue54.py | 23 ++++--------------- test/ReplayData/Issue54.setUp.txt | 20 ++++++++-------- test/ReplayData/Issue54.testConversion.txt | 5 ++++ ...ssue54.testNegativeHalfIntegerTimezone.txt | 5 ---- .../Issue54.testNegativeIntegerTimezone.txt | 5 ---- ...ssue54.testPositiveHalfIntegerTimezone.txt | 5 ---- .../Issue54.testPositiveIntegerTimezone.txt | 5 ---- 10 files changed, 21 insertions(+), 61 deletions(-) create mode 100644 test/ReplayData/Issue54.testConversion.txt delete mode 100644 test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt delete mode 100644 test/ReplayData/Issue54.testNegativeIntegerTimezone.txt delete mode 100644 test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt delete mode 100644 test/ReplayData/Issue54.testPositiveIntegerTimezone.txt diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index ae3cb41b..f76cc276 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -461,7 +461,6 @@ Class `GitAuthor` Attributes ---------- * `date`: datetime.datetime -* `timezone`: datetime.timedelta * `email`: string * `name`: string diff --git a/github/GitAuthor.py b/github/GitAuthor.py index 87c2cb56..0f9cc80e 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -21,10 +21,6 @@ class GitAuthor( GithubObject.BasicGithubObject ): def date( self ): return self._NoneIfNotSet( self._date ) - @property - def timezone( self ): - return self._NoneIfNotSet( self._timezone ) - @property def email( self ): return self._NoneIfNotSet( self._email ) @@ -35,7 +31,6 @@ class GitAuthor( GithubObject.BasicGithubObject ): def _initAttributes( self ): self._date = GithubObject.NotSet - self._timezone = GithubObject.NotSet self._email = GithubObject.NotSet self._name = GithubObject.NotSet @@ -43,7 +38,6 @@ class GitAuthor( GithubObject.BasicGithubObject ): if "date" in attributes: # pragma no branch assert attributes[ "date" ] is None or isinstance( attributes[ "date" ], ( str, unicode ) ), attributes[ "date" ] self._date = self._parseDatetime( attributes[ "date" ] ) - self._timezone = self._parseTimezone( attributes[ "date" ] ) if "email" in attributes: # pragma no branch assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] self._email = attributes[ "email" ] diff --git a/github/GithubObject.py b/github/GithubObject.py index 10d96d5c..22ee9c19 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -43,15 +43,10 @@ class BasicGithubObject( object ): elif len( s ) == 24: return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" ) elif len( s ) == 25: - return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + ( 1 if s[ 19 ] == '-' else -1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) ) else: return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" ) - @staticmethod - def _parseTimezone( s ): - assert len( s ) == 25 - return ( -1 if s[ 19 ] == '-' else 1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) ) - class GithubObject( BasicGithubObject ): def __init__( self, requester, attributes, completed ): BasicGithubObject.__init__( self, requester, attributes, completed ) diff --git a/test/Issue54.py b/test/Issue54.py index 480728c0..52221878 100644 --- a/test/Issue54.py +++ b/test/Issue54.py @@ -18,22 +18,9 @@ import Framework class Issue54( Framework.TestCase ): def setUp( self ): Framework.TestCase.setUp( self ) - self.repo = self.g.get_user().get_repo( "PyGithub" ) + self.repo = self.g.get_user().get_repo( "TestRepo" ) - def testPositiveIntegerTimezone( self ): - commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( commit.author.timezone, datetime.timedelta( hours = 7 ) ) - - def testNegativeIntegerTimezone( self ): - commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( commit.author.timezone, datetime.timedelta( hours = -7 ) ) - - # I was not able to find a real commit with an half integer timezone, so I *forged* the associated responses from Github. - # I *hope* they are what Github would send in that case - def testPositiveHalfIntegerTimezone( self ): - commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( commit.author.timezone, datetime.timedelta( hours = 7, minutes = 30 ) ) - - def testNegativeHalfIntegerTimezone( self ): - commit = self.repo.get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( commit.author.timezone, datetime.timedelta( hours = -7, minutes = -30 ) ) + def testConversion( self ): + commit = self.repo.get_git_commit( "73f320ae06cd565cf38faca34b6a482addfc721b" ) + self.assertEqual( commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n" ) + self.assertEqual( commit.author.date, datetime.datetime( 2012, 7, 13, 18, 47, 10 ) ) diff --git a/test/ReplayData/Issue54.setUp.txt b/test/ReplayData/Issue54.setUp.txt index 24c3651d..ca71e9c2 100644 --- a/test/ReplayData/Issue54.setUp.txt +++ b/test/ReplayData/Issue54.setUp.txt @@ -1,10 +1,10 @@ -GET /user {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4968'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"55f0187d26f5ca2e7103006d9837865c"'), ('date', 'Thu, 10 May 2012 19:05:23 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"total_private_repos":5,"html_url":"https://github.com/jacquev6","type":"User","url":"https://api.github.com/users/jacquev6","owned_private_repos":5,"disk_usage":16676,"plan":{"private_repos":5,"collaborators":1,"space":614400,"name":"micro"},"public_gists":1,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","blog":"http://vincent-jacques.net","private_gists":5,"login":"jacquev6","public_repos":10,"email":"vincent@vincent-jacques.net","collaborators":0,"created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","hireable":false,"followers":13,"following":24,"name":"Vincent Jacques","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","bio":"","id":327146} - -GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"72a84ed8ad0d83f6a4c09dcd388c20a1"'), ('date', 'Thu, 10 May 2012 19:05:27 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"homepage":"http://vincent-jacques.net/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_downloads":true,"watchers":13,"permissions":{"admin":true,"pull":true,"push":true},"mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":2,"language":"Python","size":196,"description":"Python library implementing the full Github API v3","git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"created_at":"2012-02-25T12:53:47Z","open_issues":15,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146},"name":"PyGithub","pushed_at":"2012-05-10T18:49:21Z","id":3544490,"ssh_url":"git@github.com:jacquev6/PyGithub.git","updated_at":"2012-05-10T18:49:21Z"} - +GET /user {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('content-length', '801'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4986'), ('server', 'nginx/1.0.13'), ('last-modified', 'Mon, 09 Jul 2012 06:49:53 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bd2b9dfc8ba65f7665102d6245a1593"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 19:06:43 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"html_url":"https://github.com/jacquev6","type":"User","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","collaborators":0,"followers":13,"company":"Criteo","plan":{"collaborators":1,"space":614400,"private_repos":5,"name":"micro"},"hireable":false,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16468,"blog":"http://vincent-jacques.net","bio":"","public_gists":3,"total_private_repos":3,"public_repos":12,"private_gists":5,"name":"Vincent Jacques","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","owned_private_repos":3,"following":26,"location":"Paris, France","id":327146,"login":"jacquev6","url":"https://api.github.com/users/jacquev6"} + +GET /repos/jacquev6/TestRepo {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1172'), ('server', 'nginx/1.0.13'), ('last-modified', 'Fri, 13 Jul 2012 18:48:49 GMT'), ('connection', 'keep-alive'), ('etag', '"385e2f22f9b54b1d56fc731de0d5c9bc"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 19:06:44 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"permissions":{"push":true,"admin":true,"pull":true},"open_issues":0,"clone_url":"https://github.com/jacquev6/TestRepo.git","ssh_url":"git@github.com:jacquev6/TestRepo.git","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","id":327146,"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225"},"description":"Test repository created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2","master_branch":"master","mirror_url":null,"has_issues":true,"html_url":"https://github.com/jacquev6/TestRepo","pushed_at":"2012-07-13T18:47:21Z","forks":1,"has_downloads":true,"created_at":"2012-07-13T18:45:21Z","full_name":"jacquev6/TestRepo","language":null,"size":96,"fork":false,"svn_url":"https://github.com/jacquev6/TestRepo","has_wiki":true,"watchers":1,"updated_at":"2012-07-13T18:48:49Z","name":"TestRepo","git_url":"git://github.com/jacquev6/TestRepo.git","private":false,"id":5023526,"homepage":null,"url":"https://api.github.com/repos/jacquev6/TestRepo"} + diff --git a/test/ReplayData/Issue54.testConversion.txt b/test/ReplayData/Issue54.testConversion.txt new file mode 100644 index 00000000..fc0800db --- /dev/null +++ b/test/ReplayData/Issue54.testConversion.txt @@ -0,0 +1,5 @@ +GET /repos/jacquev6/TestRepo/git/commits/73f320ae06cd565cf38faca34b6a482addfc721b {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('content-length', '676'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4984'), ('server', 'nginx/1.0.13'), ('last-modified', 'Fri, 13 Jul 2012 18:47:10 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"ab832024b149674b5210a1a3b146575c"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 19:06:44 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"committer":{"email":"vincent@vincent-jacques.net","date":"2012-07-13T11:47:10-07:00","name":"Vincent Jacques"},"message":"Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n","sha":"73f320ae06cd565cf38faca34b6a482addfc721b","tree":{"sha":"52fe1ba4ac2b979c0a8fbeb9f87c1b1c9f177520","url":"https://api.github.com/repos/jacquev6/TestRepo/git/trees/52fe1ba4ac2b979c0a8fbeb9f87c1b1c9f177520"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-07-13T11:47:10-07:00","name":"Vincent Jacques"},"parents":[],"url":"https://api.github.com/repos/jacquev6/TestRepo/git/commits/73f320ae06cd565cf38faca34b6a482addfc721b"} + diff --git a/test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt b/test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt deleted file mode 100644 index 0e51b344..00000000 --- a/test/ReplayData/Issue54.testNegativeHalfIntegerTimezone.txt +++ /dev/null @@ -1,5 +0,0 @@ -GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:30","name":"Vincent Jacques"}} - diff --git a/test/ReplayData/Issue54.testNegativeIntegerTimezone.txt b/test/ReplayData/Issue54.testNegativeIntegerTimezone.txt deleted file mode 100644 index 9a2b9e94..00000000 --- a/test/ReplayData/Issue54.testNegativeIntegerTimezone.txt +++ /dev/null @@ -1,5 +0,0 @@ -GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"}} - diff --git a/test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt b/test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt deleted file mode 100644 index d35c8dcd..00000000 --- a/test/ReplayData/Issue54.testPositiveHalfIntegerTimezone.txt +++ /dev/null @@ -1,5 +0,0 @@ -GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16+07:30","name":"Vincent Jacques"}} - diff --git a/test/ReplayData/Issue54.testPositiveIntegerTimezone.txt b/test/ReplayData/Issue54.testPositiveIntegerTimezone.txt deleted file mode 100644 index d614219b..00000000 --- a/test/ReplayData/Issue54.testPositiveIntegerTimezone.txt +++ /dev/null @@ -1,5 +0,0 @@ -GET /repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495 {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '910'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"eabd190c639b57d447ea6d3463da7aae"'), ('date', 'Thu, 10 May 2012 19:05:28 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","message":"Merge branch 'develop'\n","committer":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16-07:00","name":"Vincent Jacques"},"sha":"4303c5b90e2216d927155e9609436ccb8984c495","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/936f4a97f1a86392637ec002bbf89ff036a5062d","sha":"936f4a97f1a86392637ec002bbf89ff036a5062d"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/2a7e80e6421c5d4d201d60619068dea6bae612cb","sha":"2a7e80e6421c5d4d201d60619068dea6bae612cb"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad","sha":"f492784d8ca837779650d1fb406a1a3587a764ad"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-04-17T10:55:16+07:00","name":"Vincent Jacques"}} -