MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_camel_killer

Method test_camel_killer

test/test_box.py:100–128  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

98 assert Box()._safe_attr(356) == "x356"
99
100 def test_camel_killer(self):
101 assert _camel_killer("CamelCase") == "camel_case"
102 assert _camel_killer("Terrible321KeyA") == "terrible321_key_a"
103 bx = Box(camel_killer_box=True, conversion_box=False)
104
105 bx.DeadCamel = 3
106 assert bx["dead_camel"] == 3
107 assert bx.dead_camel == 3
108
109 bx["BigCamel"] = 4
110 assert bx["big_camel"] == 4
111 assert bx.big_camel == 4
112 assert bx.BigCamel == 4
113
114 bx1 = Box(camel_killer_box=True, conversion_box=True)
115 bx1["BigCamel"] = 4
116 bx1.DeadCamel = 3
117 assert bx1["big_camel"] == 4
118 assert bx1["dead_camel"] == 3
119 assert bx1.big_camel == 4
120 assert bx1.dead_camel == 3
121 assert bx1.BigCamel == 4
122 assert bx1["BigCamel"] == 4
123
124 del bx1.DeadCamel
125 assert "dead_camel" not in bx1
126 del bx1["big_camel"]
127 assert "big_camel" not in bx1
128 assert len(bx1.keys()) == 0
129
130 def test_recursive_tuples(self):
131 out = _recursive_tuples(

Callers

nothing calls this directly

Calls 3

keysMethod · 0.95
_camel_killerFunction · 0.90
BoxClass · 0.90

Tested by

no test coverage detected