File: test_Codelists.R

package info (click to toggle)
r-cran-rsdmx 0.5.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 940 kB
  • sloc: makefile: 2
file content (32 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# test_Codelists.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# Description: Unit tests for SDMX Codelists methods
#=======================
require(rsdmx, quietly = TRUE)
require(testthat)
context("SDMXCodelists")

test_that("Codelists - 2.0",{
  file <- system.file("extdata", "SDMXCodelists_Example_2.0.xml", package = "rsdmx")
  xmlObj <- xmlParse(file)
  ns <- namespaces.SDMX(xmlObj)
  codelists <- SDMXCodelists(xmlObj, ns)
  expect_is(codelists, "SDMXCodelists")
  expect_equal(length(codelists@codelists), 1L)
  
  df <- as.data.frame(codelists)
  expect_is(df, "data.frame")
})

test_that("Codelists - 2.1",{
  file <- system.file("extdata", "SDMXCodelists_Example_2.1.xml", package = "rsdmx")
  xmlObj <- xmlParse(file)
  ns <- namespaces.SDMX(xmlObj)
  codelists <- SDMXCodelists(xmlObj, ns)
  expect_is(codelists, "SDMXCodelists")
  expect_equal(length(codelists@codelists), 1L)
  
  df <- as.data.frame(codelists)
  expect_is(df, "data.frame")
})