Skip to content

Commit

Permalink
Merge pull request #465 from sunbeam-labs/464-handle-empty-config-fil…
Browse files Browse the repository at this point in the history
…epaths-better

Treat blanks as empty strings
  • Loading branch information
Ulthran authored Mar 26, 2024
2 parents 77bdf67 + 567148c commit 1f4d62b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sunbeamlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


def makepath(path: str) -> Path:
if not path:
path = ""
return Path(path).expanduser()


Expand Down
5 changes: 5 additions & 0 deletions tests/unit/sunbeamlib/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ def init(output_dir):
shutil.copytree(output_dir, "output_sunbeamlib/")
except FileExistsError as e:
pass


def test_makepath_on_none():
assert makepath(None) == Path("")
assert makepath("test") == Path("test")

0 comments on commit 1f4d62b

Please sign in to comment.