Esempio n. 1
0
 def test_raises_non_placement_keyed_dict(self):
   with self.assertRaises(TypeError):
     runtime_utils.merge_cardinalities({'a': 1},
                                       {placement_literals.CLIENTS: 10})
   with self.assertRaises(TypeError):
     runtime_utils.merge_cardinalities({placement_literals.CLIENTS: 10},
                                       {'a': 1})
Esempio n. 2
0
 def test_merges_different_placement_literals(self):
   clients_placed_cardinality = {placement_literals.CLIENTS: 10}
   server_placed_cardinality = {placement_literals.SERVER: 1}
   merged = runtime_utils.merge_cardinalities(clients_placed_cardinality,
                                              server_placed_cardinality)
   self.assertEqual(merged, {
       placement_literals.CLIENTS: 10,
       placement_literals.SERVER: 1
   })
Esempio n. 3
0
 def test_noops_no_conflict(self):
   clients_placed_cardinality = {placement_literals.CLIENTS: 10}
   noop = runtime_utils.merge_cardinalities(clients_placed_cardinality,
                                            clients_placed_cardinality)
   self.assertEqual(noop, clients_placed_cardinality)
Esempio n. 4
0
 def test_raises_merge_conflicting_cardinalities(self):
   with self.assertRaisesRegex(ValueError, 'Conflicting cardinalities'):
     runtime_utils.merge_cardinalities({placement_literals.CLIENTS: 10},
                                       {placement_literals.CLIENTS: 11})
Esempio n. 5
0
 def test_raises_non_dict_arg(self):
   with self.assertRaises(TypeError):
     runtime_utils.merge_cardinalities({}, 1)