MCPcopy Create free account
hub / github.com/python-hyper/uritemplate / RFCTemplateExamples

Class RFCTemplateExamples

tests/test_uritemplate.py:32–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32class RFCTemplateExamples(type):
33 var = {"var": "value"}
34 hello = {"hello": "Hello World!"}
35 path = {"path": "/foo/bar"}
36 x = {"x": "1024"}
37 y = {"y": "768"}
38 empty = {"empty": ""}
39 merged_x_y = merge_dicts(x, y)
40 list_ex = {"list": ["red", "green", "blue"]}
41 keys = {"keys": [("semi", ";"), ("dot", "."), ("comma", ",")]}
42
43 # # Level 1
44 # Simple string expansion
45 level1_examples = {
46 "{var}": {
47 "expansion": var,
48 "expected": "value",
49 },
50 "{hello}": {
51 "expansion": hello,
52 "expected": "Hello%20World%21",
53 },
54 }
55
56 # # Level 2
57 # Reserved string expansion
58 level2_reserved_examples = {
59 "{+var}": {
60 "expansion": var,
61 "expected": "value",
62 },
63 "{+hello}": {
64 "expansion": hello,
65 "expected": "Hello%20World!",
66 },
67 "{+path}/here": {
68 "expansion": path,
69 "expected": "/foo/bar/here",
70 },
71 "here?ref={+path}": {
72 "expansion": path,
73 "expected": "here?ref=/foo/bar",
74 },
75 }
76
77 # Fragment expansion, crosshatch-prefixed
78 level2_fragment_examples = {
79 "X{#var}": {
80 "expansion": var,
81 "expected": "X#value",
82 },
83 "X{#hello}": {"expansion": hello, "expected": "X#Hello%20World!"},
84 }
85
86 # # Level 3
87 # String expansion with multiple variables
88 level3_multiple_variable_examples = {
89 "map?{x,y}": {

Callers

nothing calls this directly

Calls 1

merge_dictsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…