Skip to content

Commit b914a1b

Browse files
Fix: Use FileNotFoundError for file not found in main.py
Replaced IOError with FileNotFoundError on line 377 of main.py to use a more specific and appropriate exception for file not found errors. test: update test_find_dotenv_no_file_raise to expect FileNotFoundError Updated test_main.py (line 351) to replace IOError with FileNotFoundError so that the test matches the updated exception handling in main.py.
1 parent 1312397 commit b914a1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/dotenv/parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ def set_mark(self) -> None:
8080

8181
def get_marked(self) -> Original:
8282
return Original(
83-
string=self.string[self.mark.chars : self.position.chars],
83+
string=self.string[self.mark.chars: self.position.chars],
8484
line=self.mark.line,
8585
)
8686

8787
def peek(self, count: int) -> str:
88-
return self.string[self.position.chars : self.position.chars + count]
88+
return self.string[self.position.chars: self.position.chars + count]
8989

9090
def read(self, count: int) -> str:
91-
result = self.string[self.position.chars : self.position.chars + count]
91+
result = self.string[self.position.chars: self.position.chars + count]
9292
if len(result) < count:
9393
raise Error("read: End of string")
9494
self.position.advance(result)
@@ -98,7 +98,7 @@ def read_regex(self, regex: Pattern[str]) -> Sequence[str]:
9898
match = regex.match(self.string, self.position.chars)
9999
if match is None:
100100
raise Error("read_regex: Pattern not found")
101-
self.position.advance(self.string[match.start() : match.end()])
101+
self.position.advance(self.string[match.start(): match.end()])
102102
return match.groups()
103103

104104

0 commit comments

Comments
 (0)