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

Method test_camel_killer

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

Source from the content-addressed store, hash-verified

61 assert Box()._safe_attr(356) == "x356"
62
63 def test_camel_killer(self):
64 assert _camel_killer("CamelCase") == "camel_case"
65 assert _camel_killer("Terrible321KeyA") == "terrible321_key_a"
66 bx = Box(camel_killer_box=True, conversion_box=False)
67
68 bx.DeadCamel = 3
69 assert bx["dead_camel"] == 3
70 assert bx.dead_camel == 3
71
72 bx["BigCamel"] = 4
73 assert bx["big_camel"] == 4
74 assert bx.big_camel == 4
75 assert bx.BigCamel == 4
76
77 bx1 = Box(camel_killer_box=True, conversion_box=True)
78 bx1["BigCamel"] = 4
79 bx1.DeadCamel = 3
80 assert bx1["big_camel"] == 4
81 assert bx1["dead_camel"] == 3
82 assert bx1.big_camel == 4
83 assert bx1.dead_camel == 3
84 assert bx1.BigCamel == 4
85 assert bx1["BigCamel"] == 4
86
87 del bx1.DeadCamel
88 assert "dead_camel" not in bx1
89 del bx1["big_camel"]
90 assert "big_camel" not in bx1
91 assert len(bx1.keys()) == 0
92
93 def test_recursive_tuples(self):
94 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