@@ -68,20 +68,22 @@ test_that("infer shapes from dataset", {
68
68
expect_error(DataDescriptor $ new(ds ), " must return a named list of tensors" )
69
69
})
70
70
71
- # test_that("assert_compatible_shapes", {
72
- # ds = make_dataset(list(x = c(2, 3)), getbatch = TRUE)
73
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 3)), ds), regexp = NA)
74
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 1)), ds), regexp = "(NA,2,1)")
75
- # ds = make_dataset(list(x = c(2, 3)), getbatch = FALSE)
76
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 3)), ds), regexp = NA)
77
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 1)), ds), regexp = "(NA,2,1)")
78
- # ds = make_dataset(list(x = c(2, 3), y = 1), getbatch = TRUE)
79
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 3), y = c(NA, 1)), ds), regexp = NA)
80
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 3), y = c(NA, 2)), ds), regexp = "shape of y")
81
- # ds = make_dataset(list(x = c(2, 3), y = 1), getbatch = FALSE)
82
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 3), y = c(NA, 1)), ds), regexp = NA)
83
- # expect_error(assert_compatible_shapes(list(x = c(NA, 2, 3), y = c(NA, 2)), ds), regexp = "shape of y")
84
- # })
71
+ test_that(" assert_compatible_shapes" , {
72
+ ds = make_dataset(list (x = c(2 , 3 )), getbatch = TRUE )
73
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 3 )), ds ), regexp = NA )
74
+ expect_error(assert_compatible_shapes(list (x = c(NA , NA , NA )), ds ), regexp = NA )
75
+ expect_error(assert_compatible_shapes(list (x = c(NA , NA , NA , NA )), ds ), " returned 3" )
76
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 1 )), ds ), regexp = " (NA,2,1)" )
77
+ ds = make_dataset(list (x = c(2 , 3 )), getbatch = FALSE )
78
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 3 )), ds ), regexp = NA )
79
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 1 )), ds ), regexp = " (NA,2,1)" )
80
+ ds = make_dataset(list (x = c(2 , 3 ), y = 1 ), getbatch = TRUE )
81
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 3 ), y = c(NA , 1 )), ds ), regexp = NA )
82
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 3 ), y = c(NA , 2 )), ds ), regexp = " shape of y" )
83
+ ds = make_dataset(list (x = c(2 , 3 ), y = 1 ), getbatch = FALSE )
84
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 3 ), y = c(NA , 1 )), ds ), regexp = NA )
85
+ expect_error(assert_compatible_shapes(list (x = c(NA , 2 , 3 ), y = c(NA , 2 )), ds ), regexp = " shape of y" )
86
+ })
85
87
86
88
test_that(" as_data_descriptor" , {
87
89
ds = make_dataset(list (x = 1 ))
0 commit comments