def Soapify(value): if hasattr(value, 'xsitype'): return (value.xsitype, str(value)) elif isinstance(value, bool): return ('xsd:boolean', cwmpbool.format(value)) elif isinstance(value, int): return ('xsd:unsignedInt', str(value)) elif isinstance(value, float): return ('xsd:double', str(value)) elif isinstance(value, datetime.datetime): return ('xsd:dateTime', cwmpdate.format(value)) else: return ('xsd:string', str(value))
def testFormat(self): self.assertEqual(cwmpbool.format(True), '1') self.assertEqual(cwmpbool.format(False), '0')