+ def test_is_set(self):
+ values = {
+ 'an_int': 42,
+ 'a_string': 'hello',
+ 'another_int': 66
+ }
+
+ int_ft = bt2.IntegerFieldType(32)
+ str_ft = bt2.StringFieldType()
+ struct_ft = bt2.StructureFieldType()
+ struct_ft.append_field(field_type=int_ft, name='an_int')
+ struct_ft.append_field(field_type=str_ft, name='a_string')
+ struct_ft.append_field(field_type=int_ft, name='another_int')
+
+ struct = struct_ft()
+ self.assertFalse(struct.is_set)
+ struct.value = values
+ self.assertTrue(struct.is_set)
+
+ struct = struct_ft()
+ struct['an_int'].value = 42
+ self.assertFalse(struct.is_set)
+
+ def test_reset(self):
+ values = {
+ 'an_int': 42,
+ 'a_string': 'hello',
+ 'another_int': 66
+ }
+
+ int_ft = bt2.IntegerFieldType(32)
+ str_ft = bt2.StringFieldType()
+ struct_ft = bt2.StructureFieldType()
+ struct_ft.append_field(field_type=int_ft, name='an_int')
+ struct_ft.append_field(field_type=str_ft, name='a_string')
+ struct_ft.append_field(field_type=int_ft, name='another_int')
+
+ struct = struct_ft()
+ struct.value = values
+ self.assertTrue(struct.is_set)
+ struct.reset()
+ self.assertEqual(struct_ft(), struct)