Пример #1
0
 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')
Пример #2
0
 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')
Пример #3
0
 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')
Пример #4
0
 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)')
Пример #5
0
 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')
Пример #6
0
 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')
Пример #7
0
 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')
Пример #8
0
 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')
Пример #9
0
 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')
Пример #10
0
 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')
Пример #11
0
 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')
Пример #12
0
 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')
Пример #13
0
 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')
Пример #14
0
 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')
Пример #15
0
 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')
Пример #16
0
 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')