Ejemplo n.º 1
0
 def testParseGroup(self):
     self.assertEqual(1, elementParser.parseGroup("1"))
     self.assertEqual(2, elementParser.parseGroup(" 2"))
     self.assertEqual(3, elementParser.parseGroup("3 "))
     self.assertEqual(None, elementParser.parseGroup(""))
     self.assertEqual(None, elementParser.parseGroup(u'\xe2\x80\x93'))
     self.assertEqual(None, elementParser.parseGroup(None))
Ejemplo n.º 2
0
 def testParseGroup(self):
     self.assertEqual(1, elementParser.parseGroup("1"))
     self.assertEqual(2, elementParser.parseGroup(" 2"))
     self.assertEqual(3, elementParser.parseGroup("3 "))
     self.assertEqual(None, elementParser.parseGroup(""))
     self.assertEqual(None, elementParser.parseGroup(u'\xe2\x80\x93'))
     self.assertEqual(None, elementParser.parseGroup(None))
Ejemplo n.º 3
0
 def get_json(self, category):
     atomic_weight = elementParser.parseAtomicWeight(self.__process_atomic_weight())
     atomic_mass = atomic_weight[0]
     atomic_mass_uncertainty = atomic_weight[1]
     jsonElement = {
         "atomic_number":            elementParser.parseAtomicNumber(      self.tds[0].find(text=True)),
         "symbol":                   elementParser.parseSymbol(            self.tds[1].find(text=True)),
         # "name":                   tds[2].find(text=True),
         # "etymology":              tds[3].findAll(text=True),
         "group":                    elementParser.parseGroup(             self.tds[4].find(text=True)),
         "period":                   elementParser.parsePeriod(            self.tds[5].find(text=True)),
         "density":                  elementParser.parseDensity(           self.tds[7].find(text=True)),
         "melting_point":            elementParser.parseTemperatureKelvin( self.tds[8].find(text=True)),
         "boiling_point":            elementParser.parseTemperatureKelvin( self.tds[9].find(text=True)),
         "specific_heat_capacity":   elementParser.parseTemperatureKelvin( self.tds[10].find(text=True)),
         "electronegativity":        elementParser.parseElectronegativity( self.tds[11].find(text=True)),
         "atomic_mass":              atomic_mass,
         "atomic_mass_uncertainty":  atomic_mass_uncertainty,
         "category":                 category
         # "abundance":              tds[12].string
     }
     jsonElement["href"] = self.tds[2].a.get("href")
     return jsonElement
Ejemplo n.º 4
0
 def get_json(self, category):
     atomic_weight = elementParser.parseAtomicWeight(
         self.__process_atomic_weight())
     atomic_mass = atomic_weight[0]
     atomic_mass_uncertainty = atomic_weight[1]
     jsonElement = {
         "atomic_number":
         elementParser.parseAtomicNumber(self.tds[0].find(text=True)),
         "symbol":
         elementParser.parseSymbol(self.tds[1].find(text=True)),
         # "name":                   tds[2].find(text=True),
         # "etymology":              tds[3].findAll(text=True),
         "group":
         elementParser.parseGroup(self.tds[4].find(text=True)),
         "period":
         elementParser.parsePeriod(self.tds[5].find(text=True)),
         "density":
         elementParser.parseDensity(self.tds[7].find(text=True)),
         "melting_point":
         elementParser.parseTemperatureKelvin(self.tds[8].find(text=True)),
         "boiling_point":
         elementParser.parseTemperatureKelvin(self.tds[9].find(text=True)),
         "specific_heat_capacity":
         elementParser.parseTemperatureKelvin(self.tds[10].find(text=True)),
         "electronegativity":
         elementParser.parseElectronegativity(self.tds[11].find(text=True)),
         "atomic_mass":
         atomic_mass,
         "atomic_mass_uncertainty":
         atomic_mass_uncertainty,
         "category":
         category
         # "abundance":              tds[12].string
     }
     jsonElement["href"] = self.tds[2].a.get("href")
     return jsonElement