def test_tracestate_valid_pairs(self): pairs = [("1a-2f@foo", "bar1"), ("foo-_*/bar", "bar4")] state = TraceState(pairs) self.assertEqual(len(state), 2) self.assertIsNotNone(state.get("foo-_*/bar")) self.assertEqual(state.get("foo-_*/bar"), "bar4") self.assertEqual(state.to_header(), "1a-2f@foo=bar1,foo-_*/bar=bar4") self.assertIsNone(state.get("random"))
def test_empty_tracestate(self): state = TraceState() self.assertEqual(len(state), 0) self.assertEqual(state.to_header(), "")