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

Method test_camel_killer

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

Source from the content-addressed store, hash-verified

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