def test_time_series(self): """ Test pyicane.TimeSeries class""" self.assertRaises(ValueError, pyicane.TimeSeries, 'not a json object') self.assertEqual(pyicane.TimeSeries( pyicane.request('time-series/232')).title, 'Afiliados medios mensuales en alta laboral')
def test_unif_of_measure(self): """ Test pyicane.UnitOfMeasure class""" self.assertRaises(ValueError, pyicane.UnitOfMeasure, 'not a json object') self.assertEqual(pyicane.UnitOfMeasure( pyicane.request('unit-of-measure/1')).title.encode('utf-8'), 'Años')
def test_subsection(self): """ Test pyicane.Subsection class""" self.assertRaises(ValueError, pyicane.Subsection, 'not a json object') self.assertEqual(pyicane.Subsection( pyicane.request('subsection/1')).title.encode('utf-8'), 'Cifras de población')
def test_source(self): """ Test pyicane.Source class""" self.assertRaises(ValueError, pyicane.Source, 'not a json object') self.assertEqual(pyicane.Source( pyicane.request('source/45')).label.encode('utf-8'), 'Censo agrario. Instituto Nacional de Estadística (INE)')
def test_data_provider(self): """ Test pyicane.DataProvider class""" self.assertRaises(ValueError, pyicane.DataProvider, 'not a json object') self.assertEqual(pyicane.DataProvider( pyicane.request('data-provider/1')).title .encode("utf-8"), 'Instituto Nacional de Estadística')
def test_category(self): """ Test pyicane.Category class""" self.assertRaises(ValueError, pyicane.Category, 'not a json object') self.assertTrue(pyicane.Category( pyicane.request('category/historical-data')).title .encode("utf-8") == 'Datos históricos')
def test_time_period(self): """ Test pyicane.TimePeriod class""" self.assertRaises(ValueError, pyicane.TimePeriod, 'not a json object') self.assertEqual(pyicane.TimePeriod( pyicane.request('time-period/593')).timeFormat, 'na')
def test_section(self): """ Test pyicane.Section class""" self.assertRaises(ValueError, pyicane.Section, 'not a json object') self.assertEqual(pyicane.Section( pyicane.request('section/society')).title, 'Sociedad')
def test_reference_area(self): """ Test pyicane.ReferenceArea class""" self.assertRaises(ValueError, pyicane.ReferenceArea, 'not a json object') self.assertEqual(pyicane.ReferenceArea( pyicane.request('reference-area/local')).title, 'Inframunicipal')
def test_periodicity(self): """ Test pyicane.Periodicity class""" self.assertRaises(ValueError, pyicane.Periodicity, 'not a json object') self.assertEqual(pyicane.Periodicity( pyicane.request('periodicity/annual')).title, 'Anual')
def test_node_type(self): """ Test pyicane.NodeType class""" self.assertRaises(ValueError, pyicane.NodeType, 'not a json object') self.assertEqual(pyicane.NodeType( pyicane.request('node-type/1')).title.encode('utf-8'), 'Sección')
def test_measure(self): """ Test pyicane.Measure class""" self.assertRaises(ValueError, pyicane.Measure, 'not a json object') self.assertEqual(pyicane.Measure(pyicane.request('measure/1')).title, 'Parados')
def test_request(self): """ Test pyicane.request() """ section_instance = pyicane.Section(pyicane.request('section/economy')) self.assertTrue(section_instance.title.encode("utf-8") == 'Economía') self.assertRaises(requests.exceptions.HTTPError, pyicane.request, 'section/economic')
def test_link_type(self): """ Test pyicane.LinkType class""" self.assertRaises(ValueError, pyicane.LinkType, 'not a json object') self.assertEqual(pyicane.LinkType(pyicane.request('link-type/1')). title, 'HTTP')
def test_link(self): """ Test pyicane.Link class""" self.assertRaises(ValueError, pyicane.Link, 'not a json object') self.assertEqual(pyicane.Link(pyicane.request('link/472')).title, 'DBpedia')
def test_data_set(self): """ Test pyicane.DataSet class""" self.assertRaises(ValueError, pyicane.DataSet, 'not a json object') self.assertEqual(pyicane.DataSet(pyicane.request('data-set/87')).title, 'Empleo de las personas con discapacidad')