diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-08-25 14:35:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-25 14:35:44 +0200 |
commit | 66afc8921e4f5d3a41e407ab6d95ce7e4ec5383a (patch) | |
tree | e552f03ee7846566b4b036c192d9ed326a9e74a5 /tests | |
parent | ec580e545ef25f117573014d40ca5c512e58dbf3 (diff) | |
download | pyasn1-66afc8921e4f5d3a41e407ab6d95ce7e4ec5383a.tar.gz |
Add `isInconsistent` property hook to all constructed types (#170)
Added `isInconsistent` property to all constructed types. This property
conceptually replaces `verifySizeSpec` method to serve a more general
purpose e.g. ensuring all required fields are in a good shape. By
default this check invokes subtype constraints verification and is run
by codecs on value de/serialisation.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/type/test_univ.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tests/type/test_univ.py b/tests/type/test_univ.py index 0092588..4cbfa01 100644 --- a/tests/type/test_univ.py +++ b/tests/type/test_univ.py @@ -1040,22 +1040,14 @@ class SequenceOf(BaseTestCase): else: pass - def testSizeSpec(self): + def testConsistency(self): s = self.s1.clone(sizeSpec=constraint.ConstraintsUnion( constraint.ValueSizeConstraint(1, 1) )) s.setComponentByPosition(0, univ.OctetString('abc')) - try: - s.verifySizeSpec() - except PyAsn1Error: - assert 0, 'size spec fails' + assert not s.isInconsistent, 'size spec fails' s.setComponentByPosition(1, univ.OctetString('abc')) - try: - s.verifySizeSpec() - except PyAsn1Error: - pass - else: - assert 0, 'size spec fails' + assert s.isInconsistent, 'size spec fails' def testGetComponentTagMap(self): assert self.s1.componentType.tagMap.presentTypes == { |