{"action":"created","comment":{"url":"https://api.github.com/repos/Chicago/RSocrata/pulls/comments/34328612","id":34328612,"diff_hunk":"@@ -0,0 +1,203 @@\n+library(testthat)\n+library(RSocrata)\n+library(curl)\n+library(httr)\n+library(jsonlite)\n+library(mime)\n+\n+context(\"posixify function\")\n+\n+test_that(\"posixify returns Long format\", {\n+  dt <- posixify(\"09/14/2012 10:38:01 PM\")\n+  expect_equal(\"POSIXlt\", class(dt)[1], \"first data type of a date\")\n+  expect_equal(2012, dt$year + 1900, \"year\")\n+  expect_equal(9, dt$mon + 1, \"month\")\n+  expect_equal(14, dt$mday, \"day\")\n+  expect_equal(22, dt$hour, \"hours\")\n+  expect_equal(38, dt$min, \"minutes\")\n+  expect_equal(1, dt$sec, \"seconds\")\n+})\n+\n+\n+test_that(\"posixify returns Short format\", {\n+  dt <- posixify(\"09/14/2012\")\n+  expect_equal(\"POSIXlt\", class(dt)[1], \"first data type of a date\")\n+  expect_equal(2012, dt$year + 1900, \"year\")\n+  expect_equal(9, dt$mon + 1, \"month\")\n+  expect_equal(14, dt$mday, \"day\")\n+  expect_equal(0, dt$hour, \"hours\")\n+  expect_equal(0, dt$min, \"minutes\")\n+  expect_equal(0, dt$sec, \"seconds\")\n+})\n+\n+context(\"read Socrata\")\n+\n+test_that(\"read Socrata CSV\", {\n+  df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv')\n+  expect_equal(1007, nrow(df), \"rows\")\n+  expect_equal(9, ncol(df), \"columns\")\n+})\n+\n+test_that(\"read Socrata JSON\", {\n+  df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.json')\n+  expect_equal(1007, nrow(df), \"rows\")\n+  expect_equal(11, ncol(df), \"columns\")\n+})\n+\n+test_that(\"read Socrata No Scheme\", {\n+  expect_error(read.socrata('soda.demo.socrata.com/resource/4334-bgaj.csv'))\n+})\n+\n+test_that(\"readSoQL\", {\n+  df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region')\n+  expect_equal(1007, nrow(df), \"rows\")\n+  expect_equal(1, ncol(df), \"columns\")\n+})\n+\n+test_that(\"readSoQLColumnNotFound (will fail)\", {\n+  # SoQL API uses field names, not human names\n+  expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=Region'))\n+})\n+\n+test_that(\"URL is private (Unauthorized) (will fail)\", {\n+  expect_error(read.socrata('http://data.cityofchicago.org/resource/j8vp-2qpg.json'))\n+})\n+\n+test_that(\"readSocrataHumanReadable\", {\n+  df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj')\n+  expect_equal(1007, nrow(df), \"rows\")\n+  expect_equal(9, ncol(df), \"columns\")\n+})\n+\n+test_that(\"format is not supported\", {\n+  # Unsupported data formats\n+  expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml'))\n+})\n+\n+context(\"Socrata Calendar\")\n+\n+test_that(\"Calendar Date Long\", {\n+  df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv')\n+  dt <- df$Datetime[1] # \"2012-09-14 22:38:01\"\n+  expect_equal(\"POSIXlt\", class(dt)[1], \"data type of a date\")\n+  expect_equal(2012, dt$year + 1900, \"year\")\n+  expect_equal(9, dt$mon + 1, \"month\")\n+  expect_equal(14, dt$mday, \"day\")\n+  expect_equal(22, dt$hour, \"hours\")\n+  expect_equal(38, dt$min, \"minutes\")\n+  expect_equal(1, dt$sec, \"seconds\")\n+})\n+\n+test_that(\"Calendar Date Short\", {\n+  df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date')\n+  dt <- df$DEBARMENT.DATE[1] # \"05/21/1981\"\n+  expect_equal(\"POSIXlt\", class(dt)[1], \"data type of a date\")\n+  expect_equal(81, dt$year, \"year\")\n+  expect_equal(5, dt$mon + 1, \"month\")\n+  expect_equal(21, dt$mday, \"day\")\n+  expect_equal(0, dt$hour, \"hours\")\n+  expect_equal(0, dt$min, \"minutes\")\n+  expect_equal(0, dt$sec, \"seconds\")\n+})\n+\n+context(\"Checks the validity of 4x4\")\n+\n+test_that(\"is 4x4\", {\n+  expect_true(isFourByFour(\"4334-bgaj\"), \"ok\")\n+  expect_false(isFourByFour(\"4334c-bgajc\"), \"11 characters instead of 9\")\n+  expect_false(isFourByFour(\"433-bga\"), \"7 characters instead of 9\")\n+  expect_false(isFourByFour(\"433-bgaj\"), \"3 characters before dash instead of 4\")\n+  expect_false(isFourByFour(\"4334-!gaj\"), \"non-alphanumeric character\")\n+})\n+\n+\n+test_that(\"is 4x4 URL\", {\n+  expect_error(read.socrata(\"https://soda.demo.socrata.com/api/views/4334c-bgajc\"), \"11 characters instead of 9\")","path":"tests/testthat/test-all.R","position":115,"original_position":115,"commit_id":"4b124e209c8e23f5c948cbda7c527fb98a9b768d","original_commit_id":"4b124e209c8e23f5c948cbda7c527fb98a9b768d","user":{"login":"tomschenkjr","id":1639121,"avatar_url":"https://avatars.githubusercontent.com/u/1639121?v=3","gravatar_id":"","url":"https://api.github.com/users/tomschenkjr","html_url":"https://github.com/tomschenkjr","followers_url":"https://api.github.com/users/tomschenkjr/followers","following_url":"https://api.github.com/users/tomschenkjr/following{/other_user}","gists_url":"https://api.github.com/users/tomschenkjr/gists{/gist_id}","starred_url":"https://api.github.com/users/tomschenkjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomschenkjr/subscriptions","organizations_url":"https://api.github.com/users/tomschenkjr/orgs","repos_url":"https://api.github.com/users/tomschenkjr/repos","events_url":"https://api.github.com/users/tomschenkjr/events{/privacy}","received_events_url":"https://api.github.com/users/tomschenkjr/received_events","type":"User","site_admin":false},"body":"I see the issue, just some differences in the RUnit approach vesus testthat. For instance, this test passes with the syntax:\r\n```r\r\ntest_that(\"is 4x4 URL\", {\r\n  expect_error(read.socrata(\"https://soda.demo.socrata.com/api/views/4334c-bgajc\"), \"4334c-bgajc is not a valid Socrata dataset unique identifier\", label=\"11 characters instead of 9\")\r\n  expect_error(read.socrata(\"https://soda.demo.socrata.com/api/views/433-bga\"), \"433-bga is not a valid Socrata dataset unique identifier\", label=\"7 characters instead of 9\")\r\n  expect_error(read.socrata(\"https://soda.demo.socrata.com/api/views/433-bgaj\"), \"433-bgaj is not a valid Socrata dataset unique identifier\", label=\"3 characters before dash instead of 4\")\r\n  expect_error(read.socrata(\"https://soda.demo.socrata.com/api/views/4334-!gaj\"), \"4334-!gaj is not a valid Socrata dataset unique identifier\", label=\"non-alphanumeric character\")\r\n})\r\n```\r\nI will make changes to the tests that fail.","created_at":"2015-07-10T05:33:19Z","updated_at":"2015-07-10T05:33:19Z","html_url":"https://github.com/Chicago/RSocrata/pull/49#discussion_r34328612","pull_request_url":"https://api.github.com/repos/Chicago/RSocrata/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/Chicago/RSocrata/pulls/comments/34328612"},"html":{"href":"https://github.com/Chicago/RSocrata/pull/49#discussion_r34328612"},"pull_request":{"href":"https://api.github.com/repos/Chicago/RSocrata/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/Chicago/RSocrata/pulls/49","id":39504962,"html_url":"https://github.com/Chicago/RSocrata/pull/49","diff_url":"https://github.com/Chicago/RSocrata/pull/49.diff","patch_url":"https://github.com/Chicago/RSocrata/pull/49.patch","issue_url":"https://api.github.com/repos/Chicago/RSocrata/issues/49","number":49,"state":"open","locked":false,"title":"Move to testthat","user":{"login":"dmpe","id":1799661,"avatar_url":"https://avatars.githubusercontent.com/u/1799661?v=3","gravatar_id":"","url":"https://api.github.com/users/dmpe","html_url":"https://github.com/dmpe","followers_url":"https://api.github.com/users/dmpe/followers","following_url":"https://api.github.com/users/dmpe/following{/other_user}","gists_url":"https://api.github.com/users/dmpe/gists{/gist_id}","starred_url":"https://api.github.com/users/dmpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmpe/subscriptions","organizations_url":"https://api.github.com/users/dmpe/orgs","repos_url":"https://api.github.com/users/dmpe/repos","events_url":"https://api.github.com/users/dmpe/events{/privacy}","received_events_url":"https://api.github.com/users/dmpe/received_events","type":"User","site_admin":false},"body":"6 tests will still continue to fail (bigger changes to the code required)\r\nupdate description\r\n#48 \r\n\r\nGiven that users do not care about tests, I wouldn't have a problem in releasing such an update. Indeed, in order to pass all the tests, there are bigger changes required e.g. this message is a  problem to testthat (not 100% sure how to fix yet)\r\n\r\n```\r\nread.socrata(\"https://soda.demo.socrata.com/api/views/433-bgaj\") does not match '3 characters before dash instead of 4'. Actual value: \"Error in validateUrl(url, app_token) : \\n  433-bgaj is not a valid Socrata dataset unique identifier.\\n\"\r\n```\r\nSimilar to the message below:\r\n```\r\n2015-07-08 19:55:02.200 getResponse: Error in httr GET: 401  http://data.cityofchicago.org/resource/j8vp-2qpg.json\r\n```","created_at":"2015-07-08T17:59:08Z","updated_at":"2015-07-10T05:33:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d34f6bd88f530cde579d8030f1313f0b3b97348f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Chicago/RSocrata/pulls/49/commits","review_comments_url":"https://api.github.com/repos/Chicago/RSocrata/pulls/49/comments","review_comment_url":"https://api.github.com/repos/Chicago/RSocrata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Chicago/RSocrata/issues/49/comments","statuses_url":"https://api.github.com/repos/Chicago/RSocrata/statuses/4b124e209c8e23f5c948cbda7c527fb98a9b768d","head":{"label":"dmpe:dev","ref":"dev","sha":"4b124e209c8e23f5c948cbda7c527fb98a9b768d","user":{"login":"dmpe","id":1799661,"avatar_url":"https://avatars.githubusercontent.com/u/1799661?v=3","gravatar_id":"","url":"https://api.github.com/users/dmpe","html_url":"https://github.com/dmpe","followers_url":"https://api.github.com/users/dmpe/followers","following_url":"https://api.github.com/users/dmpe/following{/other_user}","gists_url":"https://api.github.com/users/dmpe/gists{/gist_id}","starred_url":"https://api.github.com/users/dmpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmpe/subscriptions","organizations_url":"https://api.github.com/users/dmpe/orgs","repos_url":"https://api.github.com/users/dmpe/repos","events_url":"https://api.github.com/users/dmpe/events{/privacy}","received_events_url":"https://api.github.com/users/dmpe/received_events","type":"User","site_admin":false},"repo":{"id":38699690,"name":"RSocrata","full_name":"dmpe/RSocrata","owner":{"login":"dmpe","id":1799661,"avatar_url":"https://avatars.githubusercontent.com/u/1799661?v=3","gravatar_id":"","url":"https://api.github.com/users/dmpe","html_url":"https://github.com/dmpe","followers_url":"https://api.github.com/users/dmpe/followers","following_url":"https://api.github.com/users/dmpe/following{/other_user}","gists_url":"https://api.github.com/users/dmpe/gists{/gist_id}","starred_url":"https://api.github.com/users/dmpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmpe/subscriptions","organizations_url":"https://api.github.com/users/dmpe/orgs","repos_url":"https://api.github.com/users/dmpe/repos","events_url":"https://api.github.com/users/dmpe/events{/privacy}","received_events_url":"https://api.github.com/users/dmpe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmpe/RSocrata","description":"Downloading Socrata datasets as R data frames","fork":true,"url":"https://api.github.com/repos/dmpe/RSocrata","forks_url":"https://api.github.com/repos/dmpe/RSocrata/forks","keys_url":"https://api.github.com/repos/dmpe/RSocrata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmpe/RSocrata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmpe/RSocrata/teams","hooks_url":"https://api.github.com/repos/dmpe/RSocrata/hooks","issue_events_url":"https://api.github.com/repos/dmpe/RSocrata/issues/events{/number}","events_url":"https://api.github.com/repos/dmpe/RSocrata/events","assignees_url":"https://api.github.com/repos/dmpe/RSocrata/assignees{/user}","branches_url":"https://api.github.com/repos/dmpe/RSocrata/branches{/branch}","tags_url":"https://api.github.com/repos/dmpe/RSocrata/tags","blobs_url":"https://api.github.com/repos/dmpe/RSocrata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmpe/RSocrata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmpe/RSocrata/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmpe/RSocrata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmpe/RSocrata/statuses/{sha}","languages_url":"https://api.github.com/repos/dmpe/RSocrata/languages","stargazers_url":"https://api.github.com/repos/dmpe/RSocrata/stargazers","contributors_url":"https://api.github.com/repos/dmpe/RSocrata/contributors","subscribers_url":"https://api.github.com/repos/dmpe/RSocrata/subscribers","subscription_url":"https://api.github.com/repos/dmpe/RSocrata/subscription","commits_url":"https://api.github.com/repos/dmpe/RSocrata/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmpe/RSocrata/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmpe/RSocrata/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmpe/RSocrata/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmpe/RSocrata/contents/{+path}","compare_url":"https://api.github.com/repos/dmpe/RSocrata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmpe/RSocrata/merges","archive_url":"https://api.github.com/repos/dmpe/RSocrata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmpe/RSocrata/downloads","issues_url":"https://api.github.com/repos/dmpe/RSocrata/issues{/number}","pulls_url":"https://api.github.com/repos/dmpe/RSocrata/pulls{/number}","milestones_url":"https://api.github.com/repos/dmpe/RSocrata/milestones{/number}","notifications_url":"https://api.github.com/repos/dmpe/RSocrata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmpe/RSocrata/labels{/name}","releases_url":"https://api.github.com/repos/dmpe/RSocrata/releases{/id}","created_at":"2015-07-07T16:15:21Z","updated_at":"2015-07-07T16:15:22Z","pushed_at":"2015-07-08T19:19:25Z","git_url":"git://github.com/dmpe/RSocrata.git","ssh_url":"git@github.com:dmpe/RSocrata.git","clone_url":"https://github.com/dmpe/RSocrata.git","svn_url":"https://github.com/dmpe/RSocrata","homepage":null,"size":852,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"Chicago:dev","ref":"dev","sha":"1b92240f878b983ec01d7a7279aa09765aad52bf","user":{"login":"Chicago","id":838189,"avatar_url":"https://avatars.githubusercontent.com/u/838189?v=3","gravatar_id":"","url":"https://api.github.com/users/Chicago","html_url":"https://github.com/Chicago","followers_url":"https://api.github.com/users/Chicago/followers","following_url":"https://api.github.com/users/Chicago/following{/other_user}","gists_url":"https://api.github.com/users/Chicago/gists{/gist_id}","starred_url":"https://api.github.com/users/Chicago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chicago/subscriptions","organizations_url":"https://api.github.com/users/Chicago/orgs","repos_url":"https://api.github.com/users/Chicago/repos","events_url":"https://api.github.com/users/Chicago/events{/privacy}","received_events_url":"https://api.github.com/users/Chicago/received_events","type":"Organization","site_admin":false},"repo":{"id":12878765,"name":"RSocrata","full_name":"Chicago/RSocrata","owner":{"login":"Chicago","id":838189,"avatar_url":"https://avatars.githubusercontent.com/u/838189?v=3","gravatar_id":"","url":"https://api.github.com/users/Chicago","html_url":"https://github.com/Chicago","followers_url":"https://api.github.com/users/Chicago/followers","following_url":"https://api.github.com/users/Chicago/following{/other_user}","gists_url":"https://api.github.com/users/Chicago/gists{/gist_id}","starred_url":"https://api.github.com/users/Chicago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chicago/subscriptions","organizations_url":"https://api.github.com/users/Chicago/orgs","repos_url":"https://api.github.com/users/Chicago/repos","events_url":"https://api.github.com/users/Chicago/events{/privacy}","received_events_url":"https://api.github.com/users/Chicago/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Chicago/RSocrata","description":"Downloading Socrata datasets as R data frames","fork":false,"url":"https://api.github.com/repos/Chicago/RSocrata","forks_url":"https://api.github.com/repos/Chicago/RSocrata/forks","keys_url":"https://api.github.com/repos/Chicago/RSocrata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Chicago/RSocrata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Chicago/RSocrata/teams","hooks_url":"https://api.github.com/repos/Chicago/RSocrata/hooks","issue_events_url":"https://api.github.com/repos/Chicago/RSocrata/issues/events{/number}","events_url":"https://api.github.com/repos/Chicago/RSocrata/events","assignees_url":"https://api.github.com/repos/Chicago/RSocrata/assignees{/user}","branches_url":"https://api.github.com/repos/Chicago/RSocrata/branches{/branch}","tags_url":"https://api.github.com/repos/Chicago/RSocrata/tags","blobs_url":"https://api.github.com/repos/Chicago/RSocrata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Chicago/RSocrata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Chicago/RSocrata/git/refs{/sha}","trees_url":"https://api.github.com/repos/Chicago/RSocrata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Chicago/RSocrata/statuses/{sha}","languages_url":"https://api.github.com/repos/Chicago/RSocrata/languages","stargazers_url":"https://api.github.com/repos/Chicago/RSocrata/stargazers","contributors_url":"https://api.github.com/repos/Chicago/RSocrata/contributors","subscribers_url":"https://api.github.com/repos/Chicago/RSocrata/subscribers","subscription_url":"https://api.github.com/repos/Chicago/RSocrata/subscription","commits_url":"https://api.github.com/repos/Chicago/RSocrata/commits{/sha}","git_commits_url":"https://api.github.com/repos/Chicago/RSocrata/git/commits{/sha}","comments_url":"https://api.github.com/repos/Chicago/RSocrata/comments{/number}","issue_comment_url":"https://api.github.com/repos/Chicago/RSocrata/issues/comments{/number}","contents_url":"https://api.github.com/repos/Chicago/RSocrata/contents/{+path}","compare_url":"https://api.github.com/repos/Chicago/RSocrata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Chicago/RSocrata/merges","archive_url":"https://api.github.com/repos/Chicago/RSocrata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Chicago/RSocrata/downloads","issues_url":"https://api.github.com/repos/Chicago/RSocrata/issues{/number}","pulls_url":"https://api.github.com/repos/Chicago/RSocrata/pulls{/number}","milestones_url":"https://api.github.com/repos/Chicago/RSocrata/milestones{/number}","notifications_url":"https://api.github.com/repos/Chicago/RSocrata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Chicago/RSocrata/labels{/name}","releases_url":"https://api.github.com/repos/Chicago/RSocrata/releases{/id}","created_at":"2013-09-16T21:03:40Z","updated_at":"2015-07-08T15:06:31Z","pushed_at":"2015-07-08T19:19:26Z","git_url":"git://github.com/Chicago/RSocrata.git","ssh_url":"git@github.com:Chicago/RSocrata.git","clone_url":"https://github.com/Chicago/RSocrata.git","svn_url":"https://github.com/Chicago/RSocrata","homepage":null,"size":852,"stargazers_count":49,"watchers_count":49,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":30,"forks":26,"open_issues":30,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Chicago/RSocrata/pulls/49"},"html":{"href":"https://github.com/Chicago/RSocrata/pull/49"},"issue":{"href":"https://api.github.com/repos/Chicago/RSocrata/issues/49"},"comments":{"href":"https://api.github.com/repos/Chicago/RSocrata/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/Chicago/RSocrata/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/Chicago/RSocrata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Chicago/RSocrata/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/Chicago/RSocrata/statuses/4b124e209c8e23f5c948cbda7c527fb98a9b768d"}}}}