Skip to content

Commit debf0ed

Browse files
committed
Some more s/Python-dotenv/python-dotenv/
1 parent 3c19c03 commit debf0ed

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

.github/SECURITY.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
## Reporting a Vulnerability
1111

12-
If you believe you have identified a security issue with Python-dotenv, please email
12+
If you believe you have identified a security issue with python-dotenv, please email
1313
python-dotenv@saurabh-kumar.com. A maintainer will contact you acknowledging the report
1414
and how to continue.
1515

1616
Be sure to include as much detail as necessary in your report. As with reporting normal
1717
issues, a minimal reproducible example will help the maintainers address the issue faster.
18-
If you are able, you may also include a fix for the issue generated with `git
19-
format-patch`.
18+
If you are able, you may also include a fix for the issue generated with `git format-patch`.

tests/test_main.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def test_set_key_no_file(tmp_path):
2828
("", "a", "", (True, "a", ""), "a=''\n"),
2929
("", "a", "b", (True, "a", "b"), "a='b'\n"),
3030
("", "a", "'b'", (True, "a", "'b'"), "a='\\'b\\''\n"),
31-
("", "a", "\"b\"", (True, "a", '"b"'), "a='\"b\"'\n"),
31+
("", "a", '"b"', (True, "a", '"b"'), "a='\"b\"'\n"),
3232
("", "a", "b'c", (True, "a", "b'c"), "a='b\\'c'\n"),
33-
("", "a", "b\"c", (True, "a", "b\"c"), "a='b\"c'\n"),
33+
("", "a", 'b"c', (True, "a", 'b"c'), "a='b\"c'\n"),
3434
("a=b", "a", "c", (True, "a", "c"), "a='c'\n"),
3535
("a=b\n", "a", "c", (True, "a", "c"), "a='c'\n"),
3636
("a=b\n\n", "a", "c", (True, "a", "c"), "a='c'\n\n"),
@@ -75,20 +75,20 @@ def test_get_key_no_file(tmp_path):
7575
nx_path = tmp_path / "nx"
7676
logger = logging.getLogger("dotenv.main")
7777

78-
with mock.patch.object(logger, "info") as mock_info, \
79-
mock.patch.object(logger, "warning") as mock_warning:
78+
with (
79+
mock.patch.object(logger, "info") as mock_info,
80+
mock.patch.object(logger, "warning") as mock_warning,
81+
):
8082
result = dotenv.get_key(nx_path, "foo")
8183

8284
assert result is None
8385
mock_info.assert_has_calls(
8486
calls=[
85-
mock.call("Python-dotenv could not find configuration file %s.", nx_path)
87+
mock.call("python-dotenv could not find configuration file %s.", nx_path)
8688
],
8789
)
8890
mock_warning.assert_has_calls(
89-
calls=[
90-
mock.call("Key %s not found in %s.", "foo", nx_path)
91-
],
91+
calls=[mock.call("Key %s not found in %s.", "foo", nx_path)],
9292
)
9393

9494

@@ -249,10 +249,12 @@ def test_load_dotenv_no_file_verbose():
249249
logger = logging.getLogger("dotenv.main")
250250

251251
with mock.patch.object(logger, "info") as mock_info:
252-
result = dotenv.load_dotenv('.does_not_exist', verbose=True)
252+
result = dotenv.load_dotenv(".does_not_exist", verbose=True)
253253

254254
assert result is False
255-
mock_info.assert_called_once_with("Python-dotenv could not find configuration file %s.", ".does_not_exist")
255+
mock_info.assert_called_once_with(
256+
"python-dotenv could not find configuration file %s.", ".does_not_exist"
257+
)
256258

257259

258260
@mock.patch.dict(os.environ, {"a": "c"}, clear=True)
@@ -317,21 +319,23 @@ def test_load_dotenv_file_stream(dotenv_path):
317319

318320

319321
def test_load_dotenv_in_current_dir(tmp_path):
320-
dotenv_path = tmp_path / '.env'
321-
dotenv_path.write_bytes(b'a=b')
322-
code_path = tmp_path / 'code.py'
323-
code_path.write_text(textwrap.dedent("""
322+
dotenv_path = tmp_path / ".env"
323+
dotenv_path.write_bytes(b"a=b")
324+
code_path = tmp_path / "code.py"
325+
code_path.write_text(
326+
textwrap.dedent("""
324327
import dotenv
325328
import os
326329
327330
dotenv.load_dotenv(verbose=True)
328331
print(os.environ['a'])
329-
"""))
332+
""")
333+
)
330334
os.chdir(tmp_path)
331335

332336
result = sh.Command(sys.executable)(code_path)
333337

334-
assert result == 'b\n'
338+
assert result == "b\n"
335339

336340

337341
def test_dotenv_values_file(dotenv_path):
@@ -352,30 +356,23 @@ def test_dotenv_values_file(dotenv_path):
352356
({"b": "c"}, "a=${b}", True, {"a": "c"}),
353357
({"b": "c"}, "a=${b:-d}", False, {"a": "${b:-d}"}),
354358
({"b": "c"}, "a=${b:-d}", True, {"a": "c"}),
355-
356359
# Defined in file
357360
({}, "b=c\na=${b}", True, {"a": "c", "b": "c"}),
358-
359361
# Undefined
360362
({}, "a=${b}", True, {"a": ""}),
361363
({}, "a=${b:-d}", True, {"a": "d"}),
362-
363364
# With quotes
364365
({"b": "c"}, 'a="${b}"', True, {"a": "c"}),
365366
({"b": "c"}, "a='${b}'", True, {"a": "c"}),
366-
367367
# With surrounding text
368368
({"b": "c"}, "a=x${b}y", True, {"a": "xcy"}),
369-
370369
# Self-referential
371370
({"a": "b"}, "a=${a}", True, {"a": "b"}),
372371
({}, "a=${a}", True, {"a": ""}),
373372
({"a": "b"}, "a=${a:-c}", True, {"a": "b"}),
374373
({}, "a=${a:-c}", True, {"a": "c"}),
375-
376374
# Reused
377375
({"b": "c"}, "a=${b}${b}", True, {"a": "cc"}),
378-
379376
# Re-defined and used in file
380377
({"b": "c"}, "b=d\na=${b}", True, {"a": "d", "b": "d"}),
381378
({}, "a=b\na=c\nd=${a}", True, {"a": "c", "d": "c"}),

0 commit comments

Comments
 (0)