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:
parent
6d804c4df1
commit
b5d2b56191
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user