예제 #1
0
 def test_ctr(self):
     attributes = {"asd": "test"}
     result = sampling.SamplingResult(sampling.Decision.RECORD_ONLY,
                                      attributes)
     self.assertIs(result.decision, sampling.Decision.RECORD_ONLY)
     with self.assertRaises(TypeError):
         result.attributes["test"] = "mess-this-up"
     self.assertTrue(len(result.attributes), 1)
     self.assertEqual(result.attributes["asd"], "test")
예제 #2
0
 def test_ctr(self):
     attributes = {"asd": "test"}
     trace_state = {}
     # pylint: disable=E1137
     trace_state["test"] = "123"
     result = sampling.SamplingResult(sampling.Decision.RECORD_ONLY,
                                      attributes, trace_state)
     self.assertIs(result.decision, sampling.Decision.RECORD_ONLY)
     with self.assertRaises(TypeError):
         result.attributes["test"] = "mess-this-up"
     self.assertTrue(len(result.attributes), 1)
     self.assertEqual(result.attributes["asd"], "test")
     self.assertEqual(result.trace_state["test"], "123")