{"action":"created","comment":{"url":"https://api.github.com/repos/scrapinghub/dateparser/pulls/comments/25383500","id":25383500,"diff_hunk":"@@ -132,76 +204,171 @@ def test_periods(self, low, high, period, expected_results):\n         'some_period',\n     ])\n     def test_should_reject_easily_mistaken_dateutil_arguments(self, invalid_period):\n-        low = datetime(2014, 6, 15)\n-        period = datetime(2014, 6, 25)\n-\n-        with self.assertRaisesRegexp(ValueError, \"Invalid period: {}\".format(invalid_period)):\n-            date.get_intersecting_periods(low, period, period=invalid_period).next()\n+        self.given_period_low(datetime(2014, 6, 15))\n+        self.given_period(datetime(2014, 6, 25))\n+        self.given_invalid_period(invalid_period)\n+        self.then_should_reject_easily_mistaken_dateutil_arguments()\n \n     @parameterized.expand([\n-        param(low=datetime(2014, 4, 15), high=datetime(2014, 4, 14)),\n-        param(low=datetime(2014, 4, 25), high=datetime(2014, 4, 25)),\n+        param(low=datetime(2014, 4, 15), high=datetime(2014, 4, 14), period='month'),\n+        param(low=datetime(2014, 4, 25), high=datetime(2014, 4, 25), period='month'),\n     ])\n-    def test_empty_period(self, low, high):\n-        results = list(date.get_intersecting_periods(low, high, period='month'))\n-        self.assertEquals([], results)\n+    def test_empty_period(self, low, high, period):\n+        self.given_period_low(low)\n+        self.given_period_high(high)\n+        self.given_period(period)\n+        self.when_empty_period()\n+\n+    def given_expected_results(self, expected_results):\n+        self.expected_results = expected_results\n+\n+    def given_period_low(self, low):\n+        self.period_low = low\n+\n+    def given_invalid_period(self, invalid_period):\n+        self.invalid_period = invalid_period\n+\n+    def given_period_high(self, high):\n+        self.period_high = high\n+\n+    def given_period(self, period):\n+        self.period = period\n \n+    def when_date_intersecting_generated(self, dates):\n+        self.intersected_dates = dates\n \n-class ParseDateWithFormats(unittest.TestCase):\n+    def then_date_arguments_and_date_range_length_should_equal(self):\n+        self.assertEquals(1, len(self.intersected_dates))\n+\n+    def then_date_period_and_intersected_dates_should_equal(self):\n+        self.assertEquals(self.period_low, self.intersected_dates[0])\n+\n+    def when_should_one_date_for_each_month(self):\n+        self.intersected_dates = list(date.get_intersecting_periods(\n+            self.period_low, self.period_high, period=self.period))\n+\n+    def when_empty_period(self):\n+        self.intersected_dates = list(date.get_intersecting_periods(\n+            self.period_low, self.period_high, period=self.period))\n+\n+    def then_should_one_date_for_each_month(self):\n+        self.assertEquals(self.expected_results, self.intersected_dates)\n+\n+    def then_empty_period(self):\n+        self.assertEquals([], self.intersected_dates)\n+\n+    def then_should_reject_easily_mistaken_dateutil_arguments(self):\n+        with self.assertRaisesRegexp(ValueError, \"Invalid period: {}\".format(self.invalid_period)):\n+            date.get_intersecting_periods(self.period_low, self.period, period=self.invalid_period).next()","path":"tests/test_date.py","position":281,"original_position":281,"commit_id":"8b173bf182d9933dd33d912896eba631ba628f09","original_commit_id":"8b173bf182d9933dd33d912896eba631ba628f09","user":{"login":"Allactaga","id":2597566,"avatar_url":"https://avatars.githubusercontent.com/u/2597566?v=3","gravatar_id":"","url":"https://api.github.com/users/Allactaga","html_url":"https://github.com/Allactaga","followers_url":"https://api.github.com/users/Allactaga/followers","following_url":"https://api.github.com/users/Allactaga/following{/other_user}","gists_url":"https://api.github.com/users/Allactaga/gists{/gist_id}","starred_url":"https://api.github.com/users/Allactaga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Allactaga/subscriptions","organizations_url":"https://api.github.com/users/Allactaga/orgs","repos_url":"https://api.github.com/users/Allactaga/repos","events_url":"https://api.github.com/users/Allactaga/events{/privacy}","received_events_url":"https://api.github.com/users/Allactaga/received_events","type":"User","site_admin":false},"body":"It should be splitted into two methods, right now it combines both action and check.\r\n\r\np.s. Use tripple backticks for blocks of code - it will keep linebreaks.","created_at":"2015-02-25T21:58:16Z","updated_at":"2015-02-25T21:58:16Z","html_url":"https://github.com/scrapinghub/dateparser/pull/56#discussion_r25383500","pull_request_url":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/scrapinghub/dateparser/pulls/comments/25383500"},"html":{"href":"https://github.com/scrapinghub/dateparser/pull/56#discussion_r25383500"},"pull_request":{"href":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56","id":29283182,"html_url":"https://github.com/scrapinghub/dateparser/pull/56","diff_url":"https://github.com/scrapinghub/dateparser/pull/56.diff","patch_url":"https://github.com/scrapinghub/dateparser/pull/56.patch","issue_url":"https://api.github.com/repos/scrapinghub/dateparser/issues/56","number":56,"state":"open","locked":false,"title":"Implements issue #31","user":{"login":"tsrdatatech","id":4684832,"avatar_url":"https://avatars.githubusercontent.com/u/4684832?v=3","gravatar_id":"","url":"https://api.github.com/users/tsrdatatech","html_url":"https://github.com/tsrdatatech","followers_url":"https://api.github.com/users/tsrdatatech/followers","following_url":"https://api.github.com/users/tsrdatatech/following{/other_user}","gists_url":"https://api.github.com/users/tsrdatatech/gists{/gist_id}","starred_url":"https://api.github.com/users/tsrdatatech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsrdatatech/subscriptions","organizations_url":"https://api.github.com/users/tsrdatatech/orgs","repos_url":"https://api.github.com/users/tsrdatatech/repos","events_url":"https://api.github.com/users/tsrdatatech/events{/privacy}","received_events_url":"https://api.github.com/users/tsrdatatech/received_events","type":"User","site_admin":false},"body":"Transformed code to a given-when-then approach.","created_at":"2015-02-13T17:33:39Z","updated_at":"2015-02-25T21:58:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1db72217ece84e3a817dd295a4f3fbc70d061105","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56/commits","review_comments_url":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56/comments","review_comment_url":"https://api.github.com/repos/scrapinghub/dateparser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrapinghub/dateparser/issues/56/comments","statuses_url":"https://api.github.com/repos/scrapinghub/dateparser/statuses/8b173bf182d9933dd33d912896eba631ba628f09","head":{"label":"tsrdatatech:uniform_unit_tests","ref":"uniform_unit_tests","sha":"8b173bf182d9933dd33d912896eba631ba628f09","user":{"login":"tsrdatatech","id":4684832,"avatar_url":"https://avatars.githubusercontent.com/u/4684832?v=3","gravatar_id":"","url":"https://api.github.com/users/tsrdatatech","html_url":"https://github.com/tsrdatatech","followers_url":"https://api.github.com/users/tsrdatatech/followers","following_url":"https://api.github.com/users/tsrdatatech/following{/other_user}","gists_url":"https://api.github.com/users/tsrdatatech/gists{/gist_id}","starred_url":"https://api.github.com/users/tsrdatatech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsrdatatech/subscriptions","organizations_url":"https://api.github.com/users/tsrdatatech/orgs","repos_url":"https://api.github.com/users/tsrdatatech/repos","events_url":"https://api.github.com/users/tsrdatatech/events{/privacy}","received_events_url":"https://api.github.com/users/tsrdatatech/received_events","type":"User","site_admin":false},"repo":{"id":30245365,"name":"dateparser","full_name":"tsrdatatech/dateparser","owner":{"login":"tsrdatatech","id":4684832,"avatar_url":"https://avatars.githubusercontent.com/u/4684832?v=3","gravatar_id":"","url":"https://api.github.com/users/tsrdatatech","html_url":"https://github.com/tsrdatatech","followers_url":"https://api.github.com/users/tsrdatatech/followers","following_url":"https://api.github.com/users/tsrdatatech/following{/other_user}","gists_url":"https://api.github.com/users/tsrdatatech/gists{/gist_id}","starred_url":"https://api.github.com/users/tsrdatatech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsrdatatech/subscriptions","organizations_url":"https://api.github.com/users/tsrdatatech/orgs","repos_url":"https://api.github.com/users/tsrdatatech/repos","events_url":"https://api.github.com/users/tsrdatatech/events{/privacy}","received_events_url":"https://api.github.com/users/tsrdatatech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tsrdatatech/dateparser","description":"python parser for human readable dates","fork":true,"url":"https://api.github.com/repos/tsrdatatech/dateparser","forks_url":"https://api.github.com/repos/tsrdatatech/dateparser/forks","keys_url":"https://api.github.com/repos/tsrdatatech/dateparser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tsrdatatech/dateparser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tsrdatatech/dateparser/teams","hooks_url":"https://api.github.com/repos/tsrdatatech/dateparser/hooks","issue_events_url":"https://api.github.com/repos/tsrdatatech/dateparser/issues/events{/number}","events_url":"https://api.github.com/repos/tsrdatatech/dateparser/events","assignees_url":"https://api.github.com/repos/tsrdatatech/dateparser/assignees{/user}","branches_url":"https://api.github.com/repos/tsrdatatech/dateparser/branches{/branch}","tags_url":"https://api.github.com/repos/tsrdatatech/dateparser/tags","blobs_url":"https://api.github.com/repos/tsrdatatech/dateparser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tsrdatatech/dateparser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tsrdatatech/dateparser/git/refs{/sha}","trees_url":"https://api.github.com/repos/tsrdatatech/dateparser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tsrdatatech/dateparser/statuses/{sha}","languages_url":"https://api.github.com/repos/tsrdatatech/dateparser/languages","stargazers_url":"https://api.github.com/repos/tsrdatatech/dateparser/stargazers","contributors_url":"https://api.github.com/repos/tsrdatatech/dateparser/contributors","subscribers_url":"https://api.github.com/repos/tsrdatatech/dateparser/subscribers","subscription_url":"https://api.github.com/repos/tsrdatatech/dateparser/subscription","commits_url":"https://api.github.com/repos/tsrdatatech/dateparser/commits{/sha}","git_commits_url":"https://api.github.com/repos/tsrdatatech/dateparser/git/commits{/sha}","comments_url":"https://api.github.com/repos/tsrdatatech/dateparser/comments{/number}","issue_comment_url":"https://api.github.com/repos/tsrdatatech/dateparser/issues/comments{/number}","contents_url":"https://api.github.com/repos/tsrdatatech/dateparser/contents/{+path}","compare_url":"https://api.github.com/repos/tsrdatatech/dateparser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tsrdatatech/dateparser/merges","archive_url":"https://api.github.com/repos/tsrdatatech/dateparser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tsrdatatech/dateparser/downloads","issues_url":"https://api.github.com/repos/tsrdatatech/dateparser/issues{/number}","pulls_url":"https://api.github.com/repos/tsrdatatech/dateparser/pulls{/number}","milestones_url":"https://api.github.com/repos/tsrdatatech/dateparser/milestones{/number}","notifications_url":"https://api.github.com/repos/tsrdatatech/dateparser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tsrdatatech/dateparser/labels{/name}","releases_url":"https://api.github.com/repos/tsrdatatech/dateparser/releases{/id}","created_at":"2015-02-03T14:00:45Z","updated_at":"2015-02-03T14:00:46Z","pushed_at":"2015-02-13T17:31:53Z","git_url":"git://github.com/tsrdatatech/dateparser.git","ssh_url":"git@github.com:tsrdatatech/dateparser.git","clone_url":"https://github.com/tsrdatatech/dateparser.git","svn_url":"https://github.com/tsrdatatech/dateparser","homepage":"","size":381,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scrapinghub:master","ref":"master","sha":"6145f205ee7eeb2f153da991e1da93aa582d6c5f","user":{"login":"scrapinghub","id":699596,"avatar_url":"https://avatars.githubusercontent.com/u/699596?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapinghub","html_url":"https://github.com/scrapinghub","followers_url":"https://api.github.com/users/scrapinghub/followers","following_url":"https://api.github.com/users/scrapinghub/following{/other_user}","gists_url":"https://api.github.com/users/scrapinghub/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapinghub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapinghub/subscriptions","organizations_url":"https://api.github.com/users/scrapinghub/orgs","repos_url":"https://api.github.com/users/scrapinghub/repos","events_url":"https://api.github.com/users/scrapinghub/events{/privacy}","received_events_url":"https://api.github.com/users/scrapinghub/received_events","type":"Organization","site_admin":false},"repo":{"id":27086567,"name":"dateparser","full_name":"scrapinghub/dateparser","owner":{"login":"scrapinghub","id":699596,"avatar_url":"https://avatars.githubusercontent.com/u/699596?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapinghub","html_url":"https://github.com/scrapinghub","followers_url":"https://api.github.com/users/scrapinghub/followers","following_url":"https://api.github.com/users/scrapinghub/following{/other_user}","gists_url":"https://api.github.com/users/scrapinghub/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapinghub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapinghub/subscriptions","organizations_url":"https://api.github.com/users/scrapinghub/orgs","repos_url":"https://api.github.com/users/scrapinghub/repos","events_url":"https://api.github.com/users/scrapinghub/events{/privacy}","received_events_url":"https://api.github.com/users/scrapinghub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapinghub/dateparser","description":"python parser for human readable dates","fork":false,"url":"https://api.github.com/repos/scrapinghub/dateparser","forks_url":"https://api.github.com/repos/scrapinghub/dateparser/forks","keys_url":"https://api.github.com/repos/scrapinghub/dateparser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapinghub/dateparser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapinghub/dateparser/teams","hooks_url":"https://api.github.com/repos/scrapinghub/dateparser/hooks","issue_events_url":"https://api.github.com/repos/scrapinghub/dateparser/issues/events{/number}","events_url":"https://api.github.com/repos/scrapinghub/dateparser/events","assignees_url":"https://api.github.com/repos/scrapinghub/dateparser/assignees{/user}","branches_url":"https://api.github.com/repos/scrapinghub/dateparser/branches{/branch}","tags_url":"https://api.github.com/repos/scrapinghub/dateparser/tags","blobs_url":"https://api.github.com/repos/scrapinghub/dateparser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapinghub/dateparser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapinghub/dateparser/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapinghub/dateparser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapinghub/dateparser/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapinghub/dateparser/languages","stargazers_url":"https://api.github.com/repos/scrapinghub/dateparser/stargazers","contributors_url":"https://api.github.com/repos/scrapinghub/dateparser/contributors","subscribers_url":"https://api.github.com/repos/scrapinghub/dateparser/subscribers","subscription_url":"https://api.github.com/repos/scrapinghub/dateparser/subscription","commits_url":"https://api.github.com/repos/scrapinghub/dateparser/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapinghub/dateparser/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapinghub/dateparser/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapinghub/dateparser/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrapinghub/dateparser/contents/{+path}","compare_url":"https://api.github.com/repos/scrapinghub/dateparser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapinghub/dateparser/merges","archive_url":"https://api.github.com/repos/scrapinghub/dateparser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapinghub/dateparser/downloads","issues_url":"https://api.github.com/repos/scrapinghub/dateparser/issues{/number}","pulls_url":"https://api.github.com/repos/scrapinghub/dateparser/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapinghub/dateparser/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapinghub/dateparser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapinghub/dateparser/labels{/name}","releases_url":"https://api.github.com/repos/scrapinghub/dateparser/releases{/id}","created_at":"2014-11-24T17:30:12Z","updated_at":"2015-02-20T15:57:12Z","pushed_at":"2015-02-20T14:49:54Z","git_url":"git://github.com/scrapinghub/dateparser.git","ssh_url":"git@github.com:scrapinghub/dateparser.git","clone_url":"https://github.com/scrapinghub/dateparser.git","svn_url":"https://github.com/scrapinghub/dateparser","homepage":"","size":1432,"stargazers_count":335,"watchers_count":335,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":13,"forks":24,"open_issues":13,"watchers":335,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56"},"html":{"href":"https://github.com/scrapinghub/dateparser/pull/56"},"issue":{"href":"https://api.github.com/repos/scrapinghub/dateparser/issues/56"},"comments":{"href":"https://api.github.com/repos/scrapinghub/dateparser/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/scrapinghub/dateparser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrapinghub/dateparser/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/scrapinghub/dateparser/statuses/8b173bf182d9933dd33d912896eba631ba628f09"}}}}