def testUnicode(self): """Test that attributes are properly converted to Unicode""" msg1 = dev_tool.LogMsg("Error Message", "ed_main", "err") self.assertTrue(ebmlib.IsUnicode(msg1.Value)) self.assertTrue(ebmlib.IsUnicode(msg1.Origin)) self.assertTrue(ebmlib.IsUnicode(msg1.Type)) self.assertTrue(ebmlib.IsUnicode(msg1.ClockTime)) self.assertTrue(ebmlib.IsUnicode(unicode(msg1))) # Test with some non ascii values for conversion msg2 = dev_tool.LogMsg('\\u0259','\\u0259','\\u0259') self.assertTrue(ebmlib.IsUnicode(msg2.Value)) self.assertTrue(ebmlib.IsUnicode(msg2.Origin)) self.assertTrue(ebmlib.IsUnicode(msg2.Type)) self.assertTrue(ebmlib.IsUnicode(unicode(msg2)))
def setUp(self): self.err = dev_tool.LogMsg("Error Message", "ed_main", "err") self.err2 = dev_tool.LogMsg("Error Message", "ed_stc", "err") self.warn = dev_tool.LogMsg("Warning Message", "ed_main", "warn") self.warn2 = dev_tool.LogMsg("Warning Message", "ed_stc", "warn") self.info = dev_tool.LogMsg("Info Message", "ed_main", "info") self.info2 = dev_tool.LogMsg("Info Message", "ed_stc", "info")
def testString(self): """Test conversion to bytestring""" msg1 = dev_tool.LogMsg("Error Message", "ed_main", "err") self.assertTrue(not ebmlib.IsUnicode(str(msg1)))