def test_bitstring_empty(self): self.assertTrue(ASN1Tools.bitstring_is_empty(BitString([]))) self.assertTrue(ASN1Tools.bitstring_is_empty(BitString([0]))) self.assertTrue(ASN1Tools.bitstring_is_empty(BitString([0, 0, 0]))) self.assertFalse(ASN1Tools.bitstring_is_empty(BitString([1]))) self.assertFalse(ASN1Tools.bitstring_is_empty(BitString([0, 1]))) self.assertFalse(ASN1Tools.bitstring_is_empty(BitString([0, 0, 1, 0])))
def all_bits_zero(self): return ASN1Tools.bitstring_is_empty( self.asn1) if (self.asn1 is not None) else None