Skip to content

Commit

Permalink
tests proposed code for simonw#2198
Browse files Browse the repository at this point in the history
  • Loading branch information
hcarter333 committed Apr 28, 2024
1 parent 8f9509f commit 2ecab32
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_loadextension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from datasette.utils import LoadExtension

def test_dos_path():
path_string = "C:\Windows\System32\mod_spatialite.dll"
le = LoadExtension()
path = le.convert(path_string, None, None)
assert path == "C:\Windows\System32\mod_spatialite.dll"

def test_dos_pathentry():
path_entry = "C:\Windows\System32\mod_spatialite.dll:testentry"
le = LoadExtension()
pathen, entry = le.convert(path_entry, None, None)
assert pathen == "C:\Windows\System32\mod_spatialite.dll"
assert entry == "testentry"

def test_linux_path():
path_string = "/base/test/test2"
le = LoadExtension()
path = le.convert(path_string, None, None)
assert path == path_string

def test_linux_path_entry():
path_string = "/base/test/test2:testentry"
le = LoadExtension()
path, entry = le.convert(path_string, None, None)
assert path == "/base/test/test2"
assert entry == "testentry"

0 comments on commit 2ecab32

Please sign in to comment.