@@ -3,18 +3,20 @@ context ('extract-objects')
3
3
test_that (' missing objects' , {
4
4
expect_error (extract_osm_objects (), ' key must be provided' )
5
5
expect_error (extract_osm_objects (' aaa' ), ' bbox must be provided' )
6
- })
6
+ })
7
7
8
8
test_that (' key missing' , {
9
9
bbox <- get_bbox (c (- 0.12 , 51.51 , - 0.11 , 51.52 ))
10
10
expect_error (extract_osm_objects (bbox = bbox , key = ' ' ),
11
11
' key must be provided' )
12
12
expect_error (extract_osm_objects (bbox = bbox ), ' key must be provided' )
13
- })
13
+ })
14
14
15
15
if (curl :: has_internet ()) # otherwise all of these return errors not warnings
16
16
{
17
17
test_that (' invalid key' , {
18
+ skip_on_cran ()
19
+
18
20
bbox <- get_bbox (c (- 0.12 , 51.51 , - 0.11 , 51.52 ))
19
21
# No warning specified here because different warnings will be
20
22
# given if download fails
@@ -24,6 +26,8 @@ if (curl::has_internet ()) # otherwise all of these return errors not warnings
24
26
})
25
27
26
28
test_that (' valid key' , {
29
+ skip_on_cran ()
30
+
27
31
bbox <- get_bbox (c (- 0.12 , 51.515 , - 0.115 , 51.52 ))
28
32
dat <- extract_osm_objects (bbox = bbox , key = ' building' )
29
33
# Will return NULL if any warnings are generated (such as by
@@ -33,17 +37,19 @@ if (curl::has_internet ()) # otherwise all of these return errors not warnings
33
37
})
34
38
35
39
test_that (' return_type' , {
36
- key <- ' route'
37
- value <- ' bicycle'
38
- extra_pairs <- c (' name' , ' London.Cycle.Network.Route.9' )
39
- bbox <- get_bbox (c (- 0.26 ,51.47 ,0.11 ,51.67 ))
40
- # This can't be run because any downloading issues generate
41
- # warnings. Only if downloading succeeds will the message be
42
- # generated ('Cannot determine return_type, maybe specify
43
- # explicitly?')
44
- # expect_message (dat <- extract_osm_objects (bbox=bbox, key=key,
45
- # value=value,
46
- # extra_pairs=extra_pairs))
40
+ skip_on_cran ()
41
+
42
+ key <- ' route'
43
+ value <- ' bicycle'
44
+ extra_pairs <- c (' name' , ' London.Cycle.Network.Route.9' )
45
+ bbox <- get_bbox (c (- 0.26 ,51.47 ,0.11 ,51.67 ))
46
+ # This can't be run because any downloading issues generate
47
+ # warnings. Only if downloading succeeds will the message be
48
+ # generated ('Cannot determine return_type, maybe specify
49
+ # explicitly?')
50
+ expect_message (dat <- extract_osm_objects (bbox = bbox , key = key ,
51
+ value = value ,
52
+ extra_pairs = extra_pairs ))
47
53
})
48
54
49
55
} # end if has_internet
0 commit comments