MCPcopy Create free account
hub / github.com/theskumar/python-dotenv / test_set_key

Function test_set_key

tests/test_main.py:43–53  ·  view source on GitHub ↗
(dotenv_file, before, key, value, expected, after)

Source from the content-addressed store, hash-verified

41 ],
42)
43def test_set_key(dotenv_file, before, key, value, expected, after):
44 logger = logging.getLogger("dotenv.main")
45 with open(dotenv_file, "w") as f:
46 f.write(before)
47
48 with mock.patch.object(logger, "warning") as mock_warning:
49 result = dotenv.set_key(dotenv_file, key, value)
50
51 assert result == expected
52 assert open(dotenv_file, "r").read() == after
53 mock_warning.assert_not_called()
54
55
56def test_set_key_encoding(dotenv_file):

Callers

nothing calls this directly

Calls 1

readMethod · 0.80

Tested by

no test coverage detected