1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-09-28 22:15:23 +08:00

make the str() of a CharacterString more closely match an OctetString because the strValue is an octet string

This commit is contained in:
Joel Bender 2015-09-05 23:56:56 -04:00
parent 6d804c4df1
commit b5d2b56191
4 changed files with 4 additions and 4 deletions

View File

@ -824,7 +824,7 @@ class CharacterString(Atomic):
self.value = '### unknown encoding: %d ###' % (self.strEncoding,)
def __str__(self):
return "CharacterString(%d," % (self.strEncoding,) + repr(self.strValue) + ")"
return "CharacterString(%d,X'%s')" % (self.strEncoding, btox(self.strValue))
#
# BitString

View File

@ -824,7 +824,7 @@ class CharacterString(Atomic):
self.value = '### unknown encoding: %d ###' % (self.strEncoding,)
def __str__(self):
return "CharacterString(%d," % (self.strEncoding,) + repr(self.strValue) + ")"
return "CharacterString(%d,X'%s')" % (self.strEncoding, btox(self.strValue))
#
# BitString

View File

@ -837,7 +837,7 @@ class CharacterString(Atomic):
self.value = '### unknown encoding: %d ###' % (self.strEncoding,)
def __str__(self):
return "CharacterString(%d," % (self.strEncoding,) + repr(self.strValue) + ")"
return "CharacterString(%d,X'%s')" % (self.strEncoding, btox(self.strValue))
#
# BitString

View File

@ -88,7 +88,7 @@ class TestCharacterString(unittest.TestCase):
obj = CharacterString("hello")
assert obj.value == "hello"
assert str(obj) == "CharacterString(0,'hello')"
assert str(obj) == "CharacterString(0,X'68656c6c6f')"
def test_character_string_tag(self):
if _debug: TestCharacterString._debug("test_character_string_tag")