Exemple #1
0
    def test_decimal_commas_bug(self):
        # some Clarity installs return numeric values with commas in place of decimal points due to locale setting

        test_parsed_xml = ETree.fromstring("""
<art:artifact xmlns:art="http://genologics.com/ri/artifact">
   <udf:field xmlns:udf="http://genologics.com/ri/userdefined" type="Numeric" name="udfname">0,005</udf:field>
</art:artifact>
""")

        element = Artifact(lims=self.lims, xml_root=test_parsed_xml)
        self.assertEqual(element['udfname'], 0.005)
Exemple #2
0
 def element_from_xml(element_class, xml, **extra_kwargs):
     try:
         return element_class(lims=FakeLims(),
                              xml_root=ETree.fromstring(xml),
                              **extra_kwargs)
     except TypeError as e:
         str(e)
         if "__init__() takes at least" in str(e):
             raise TypeError(
                 "Unable to instantiate %s, provide extra args in extra_kwargs. %s"
                 % (element_class.__name__, e))
         else:
             raise e
Exemple #3
0
 def _normalize_xml(xml_string):
     xml_obj_one = ETree.fromstring(xml_string)
     return ETree.tostring(xml_obj_one)