def test_set_int_field(self, initial_fields, value): list_value, num_values = _wrapped_value_and_num(value) field_map = _set_protomap_from_dict(initial_fields) struct_utils.set_int_field(field_map, 'field', value) self.assertIn('field', field_map) self.assertLen(field_map['field'].values, num_values) self.assertEqual([v.int_value for v in field_map['field'].values], list_value)
def test_get_int_field(self, value, is_single_field, expected): key = 'field' field_map = _set_protomap_from_dict({}) struct_utils.set_int_field(field_map, key, value) actual = struct_utils.get_int_field(field_map, key, is_single_field) self.assertEqual(actual, expected) # Test long handling in Python 2 if sys.version_info.major < 3: field_map = _set_protomap_from_dict({}) struct_utils.set_int_field(field_map, key, [long(v) for v in value]) actual = struct_utils.get_int_field(field_map, key, is_single_field) self.assertEqual(actual, expected)
def set_min_dp(variant_call, min_dp): """Sets the 'MIN_DP' field of the VariantCall.""" struct_utils.set_int_field(variant_call.info, 'MIN_DP', min_dp)
def test_get_int_field(self, value, is_single_field, expected): key = 'field' field_map = _set_protomap_from_dict({}) struct_utils.set_int_field(field_map, key, value) actual = struct_utils.get_int_field(field_map, key, is_single_field) self.assertEqual(actual, expected)