Beispiel #1
0
 def _get_dict_mapping(cls, prop, data):
     mapping = {}
     for name, value in data.items():
         if isinstance(value, (dict, collections.Mapping)):
             dict_merge(mapping, cls._get_dict_mapping(name, value))
         else:
             dict_merge(mapping, cls._get_field_mapping(name, value))
     return {prop: {'properties': mapping}}
 def test_dm_empty(self):
     d1 = {}
     dict_merge(d1, {})
     self.assertEqual(d1, {})
     dict_merge(d1, dict(foo=42))
     self.assertEqual(d1, dict(foo=42))
     dict_merge(d1, dict(foo=43))
     self.assertEqual(d1, dict(foo=43))
 def test_dm_rec(self):
     d1 = dict(foo=dict(bar=42))
     dict_merge(d1, dict(foo=dict(foo=44)))
     self.assertEqual(d1, dict(foo=dict(bar=42, foo=44)))
     dict_merge(d1, dict(foo=dict(foo=42)))
     self.assertEqual(d1, dict(foo=dict(bar=42, foo=42)))
Beispiel #4
0
 def _get_document_mapping(self, benchmark):
     fields = {}
     for run in ESExporter._get_benchmark_runs(self.campaign, benchmark):
         dict_merge(fields, ESExporter._get_dict_mapping(benchmark, run))
     return fields
Beispiel #5
0
 def execution_matrix(self):
     clazz = self.get_benchmark_clazz()
     benchmark = clazz()
     dict_merge(benchmark.attributes, self.attributes)
     return list(benchmark.execution_matrix(self.exec_context))