11"""Targeted coverage tests for uncovered lines in loader.py and cli.py."""
2+
23import pytest
34import tempfile
45import yaml
@@ -18,12 +19,16 @@ def test_double_quote_toggle_with_hash(self):
1819 # A value with a " inside it, followed by # outside quotes
1920 # The " should be detected as the start/end of double-quoting
2021 result = _strip_inline_comment ('prefix "hello" # comment' )
21- assert result == 'prefix "hello"' , f"Expected comment stripped after quoted section, got: { result !r} "
22+ assert result == 'prefix "hello"' , (
23+ f"Expected comment stripped after quoted section, got: { result !r} "
24+ )
2225
2326 def test_single_quote_toggle_with_hash (self ):
2427 """Line 74: in_single should toggle when encountering ' outside double quotes."""
2528 result = _strip_inline_comment ("prefix 'hello' # comment" )
26- assert result == "prefix 'hello'" , f"Expected comment stripped after quoted section, got: { result !r} "
29+ assert result == "prefix 'hello'" , (
30+ f"Expected comment stripped after quoted section, got: { result !r} "
31+ )
2732
2833
2934class TestLoadDotenvQuoteStrip :
@@ -54,7 +59,7 @@ def test_unknown_ext_invalid_utf8_raises_valueerror(self):
5459 with tempfile .TemporaryDirectory () as tmpdir :
5560 p = Path (tmpdir ) / "config.bin"
5661 # Binary bytes that can't be decoded as UTF-8
57- p .write_bytes (b' \xff \xfe \x00 \x00 hello' )
62+ p .write_bytes (b" \xff \xfe \x00 \x00 hello" )
5863 with pytest .raises (ValueError , match = "Unsupported file format: .bin" ):
5964 load_file (str (p ))
6065
@@ -73,5 +78,8 @@ def test_scan_silent_strict_any_drift(self):
7378 (dev_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "localhost" }))
7479 (prod_dir / "c.yaml" ).write_text (yaml .dump ({"host" : "prod.example.com" }))
7580
76- result = runner .invoke (app , ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "silent" , "--strict" ])
81+ result = runner .invoke (
82+ app ,
83+ ["scan" , str (dev_dir ), str (prod_dir ), "--output" , "silent" , "--strict" ],
84+ )
7785 assert result .exit_code == 1
0 commit comments