def testWriteCorrectConstraints(self):
    value16 = self.VALUE16_CORRECT_CONSTRAINT
    unionConstraints = self.api.UnionConstraints()
    unionConstraints.setValue16(value16)
    writer = zserio.BitStreamWriter()
    unionConstraints.write(writer)
    reader = zserio.BitStreamReader(writer.getByteArray())
    readUnionConstraints = self.api.UnionConstraints.fromReader(reader)
    self.assertEqual(self.api.UnionConstraints.CHOICE_value16, readUnionConstraints.choiceTag())
    self.assertEqual(value16, readUnionConstraints.getValue16())
    self.assertEqual(unionConstraints, readUnionConstraints)
def testWriteCorrectConstraints(self):
    value16 = self.VALUE16_CORRECT_CONSTRAINT
    unionConstraints = self.api.UnionConstraints()
    unionConstraints.setValue16(value16)
    writer = zserio.BitStreamWriter()
    unionConstraints.write(writer)
    reader = zserio.BitStreamReader(writer.getByteArray())
    readUnionConstraints = self.api.UnionConstraints.fromReader(reader)
    self.assertEqual(self.api.UnionConstraints.CHOICE_value16, readUnionConstraints.choiceTag())
    self.assertEqual(value16, readUnionConstraints.getValue16())
    self.assertEqual(unionConstraints, readUnionConstraints)