Пример #1
0
 def test_reserved_format_field_get_fn(self):
     info = variants_pb2.VariantCall().info
     expected = [0.2, 0.5, 0.3]
     struct_utils.set_number_field(info, 'GP', expected[:])
     get_fn = vcf_constants.reserved_format_field_get_fn('GP')
     actual = get_fn(info, 'GP')
     self.assertEqual(actual, expected)
Пример #2
0
 def test_set_number_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_number_field(field_map, 'field', value)
     self.assertIn('field', field_map)
     self.assertLen(field_map['field'].values, num_values)
     self.assertEqual([v.number_value for v in field_map['field'].values],
                      list_value)
Пример #3
0
 def test_get_number_field(self, value, is_single_field, expected):
     key = 'field'
     field_map = _set_protomap_from_dict({})
     struct_utils.set_number_field(field_map, key, value)
     actual = struct_utils.get_number_field(field_map, key, is_single_field)
     self.assertEqual(actual, expected)