Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Water
dataRetrieval
Commits
87cbf9b3
Commit
87cbf9b3
authored
May 19, 2017
by
Laura A DeCicco
Browse files
Add some more skip_on_cran just in case
parent
1ca3f5fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/testthat/tests_userFriendly_fxns.R
View file @
87cbf9b3
...
...
@@ -202,6 +202,8 @@ test_that("readNWISuse tests", {
context
(
"state tests"
)
test_that
(
"state county tests"
,{
testthat
::
skip_on_cran
()
fullName
<-
stateCdLookup
(
"wi"
,
"fullName"
)
expect_equal
(
fullName
,
"Wisconsin"
)
...
...
@@ -235,6 +237,7 @@ df_test <- data.frame(site_no = as.character(1:13),
result_va
=
1
:
13
,
stringsAsFactors
=
FALSE
)
test_that
(
"addWaterYear works with Date, POSIXct, character, but breaks with numeric"
,
{
testthat
::
skip_on_cran
()
library
(
dplyr
)
df_date
<-
df_test
...
...
@@ -254,7 +257,7 @@ test_that("addWaterYear works with Date, POSIXct, character, but breaks with num
})
test_that
(
"addWaterYear works for each column name"
,
{
testthat
::
skip_on_cran
()
nwisqw_style
<-
df_test
nwisqw_style_wy
<-
addWaterYear
(
nwisqw_style
)
expect_equal
(
ncol
(
nwisqw_style_wy
),
ncol
(
nwisqw_style
)
+
1
)
...
...
@@ -277,6 +280,7 @@ test_that("addWaterYear works for each column name", {
})
test_that
(
"addWaterYear correctly calculates the WY and is numeric"
,
{
testthat
::
skip_on_cran
()
df_test_wy
<-
addWaterYear
(
df_test
)
expect_is
(
df_test_wy
[[
'waterYear'
]],
"numeric"
)
expect_true
(
all
(
df_test_wy
[[
'waterYear'
]][
1
:
9
]
==
2010
))
...
...
@@ -284,18 +288,21 @@ test_that("addWaterYear correctly calculates the WY and is numeric", {
})
test_that
(
"addWaterYear adds column next to dateTime"
,
{
testthat
::
skip_on_cran
()
df_test_wy
<-
addWaterYear
(
df_test
)
dateTime_col
<-
which
(
names
(
df_test_wy
)
==
"dateTime"
)
expect_equal
(
names
(
df_test_wy
)[
dateTime_col
+
1
],
"waterYear"
)
})
test_that
(
"addWaterYear can be used with pipes"
,
{
testthat
::
skip_on_cran
()
library
(
dplyr
)
df_test_wy
<-
df_test
%>%
addWaterYear
()
expect_equal
(
ncol
(
df_test_wy
),
ncol
(
df_test
)
+
1
)
})
test_that
(
"addWaterYear doesn't add another WY column if it exists"
,
{
testthat
::
skip_on_cran
()
df_test_wy
<-
addWaterYear
(
df_test
)
expect_equal
(
ncol
(
df_test_wy
),
ncol
(
df_test
)
+
1
)
df_test_wy2
<-
addWaterYear
(
df_test_wy
)
...
...
@@ -303,6 +310,7 @@ test_that("addWaterYear doesn't add another WY column if it exists", {
})
test_that
(
"calcWaterYear can handle missing values"
,
{
testthat
::
skip_on_cran
()
dateVec
<-
seq
(
as.Date
(
"2010-01-01"
),
as.Date
(
"2011-01-31"
),
by
=
"months"
)
dateVec
[
c
(
3
,
7
,
12
)]
<-
NA
wyVec
<-
dataRetrieval
:::
calcWaterYear
(
dateVec
)
...
...
@@ -314,6 +322,7 @@ test_that("calcWaterYear can handle missing values", {
context
(
"Construct NWIS urls"
)
test_that
(
"Construct NWIS urls"
,
{
testthat
::
skip_on_cran
()
siteNumber
<-
'01594440'
startDate
<-
'1985-01-01'
...
...
@@ -368,7 +377,17 @@ test_that("Construct NWIS urls", {
context
(
"Construct WQP urls"
)
test_that
(
"Construct WQP urls"
,
{
testthat
::
skip_on_cran
()
site_id
<-
'01594440'
startDate
<-
'1985-01-01'
endDate
<-
''
pCode
<-
c
(
"00060"
,
"00010"
)
url_wqp
<-
constructWQPURL
(
paste
(
"USGS"
,
site_id
,
sep
=
"-"
),
c
(
'01075'
,
'00029'
,
'00453'
),
startDate
,
endDate
)
expect_equal
(
url_wqp
,
"https://www.waterqualitydata.us/Result/search?siteid=USGS-01594440&pCode=01075;00029;00453&startDateLo=01-01-1985&sorted=no&mimeType=tsv"
)
})
context
(
"checkWQPdates"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment