diff options
author | Ilya Etingof <etingof@gmail.com> | 2017-11-19 16:41:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-19 16:41:26 +0100 |
commit | 5efe9f213563560d26bd34b6d9b3642642565b41 (patch) | |
tree | 87424f2b94fb3360c15ccad18c064518e3328830 /tests | |
parent | c156221fce2b2e9061ee5095ce6488c829e62698 (diff) | |
download | pyasn1-5efe9f213563560d26bd34b6d9b3642642565b41.tar.gz |
Start `.prettyPrint` deprecation (#103)
* __str__() of ASN.1 types reworked to serve instead of .prettyPrint()
Related changes: `str()` on enumerations and boolean will return
a string label rather than a number.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/type/test_univ.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/type/test_univ.py b/tests/type/test_univ.py index a7183db..6819251 100644 --- a/tests/type/test_univ.py +++ b/tests/type/test_univ.py @@ -282,7 +282,8 @@ class IntegerTestCase(BaseTestCase): namedValues = univ.Integer.namedValues.clone(('asn1', 1)) assert Integer('asn1') == 1, 'named val fails' - assert str(Integer('asn1')) != 'asn1', 'named val __str__() fails' + assert int(Integer('asn1')) == 1, 'named val fails' + assert str(Integer('asn1')) == 'asn1', 'named val __str__() fails' def testSubtype(self): assert univ.Integer().subtype( @@ -323,7 +324,10 @@ class BooleanTestCase(BaseTestCase): assert not univ.Boolean(False) and not univ.Boolean(0), 'False initializer fails' def testStr(self): - assert str(univ.Boolean(1)) in ('1', '1L'), 'str() fails' + assert str(univ.Boolean(1)) == 'True', 'str() fails' + + def testInt(self): + assert int(univ.Boolean(1)) == 1, 'int() fails' def testRepr(self): assert 'Boolean' in repr(univ.Boolean(1)) |