Skip to content

Commit 9db39c6

Browse files
committed
test
1 parent bc3bb14 commit 9db39c6

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright The OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import unittest
16+
17+
from opentelemetry.trace.propagation.textmap import DictGetter
18+
19+
20+
class TestDictGetter(unittest.TestCase):
21+
def test_get_none(self):
22+
getter = DictGetter()
23+
carrier = {}
24+
val = getter.get(carrier, "test")
25+
self.assertIsNone(val)
26+
27+
def test_get_str(self):
28+
getter = DictGetter()
29+
carrier = {"test":"val"}
30+
val = getter.get(carrier, "test")
31+
self.assertEqual(val, ["val"])
32+
33+
def test_get_iter(self):
34+
getter = DictGetter()
35+
carrier = {"test":["val"]}
36+
val = getter.get(carrier, "test")
37+
self.assertEqual(val, ["val"])
38+
39+
def test_keys(self):
40+
getter = DictGetter()
41+
keys = getter.keys({"test":"val"})
42+
self.assertEqual(keys, ["test"])

0 commit comments

Comments
 (0)