kopia lustrzana https://github.com/micropython/micropython-lib
os.path: test_path.py: Use paths relative to module dir.
Allows to run via test aggregators.pull/216/head
rodzic
e9b54606e9
commit
61f9dd8721
|
@ -1,5 +1,10 @@
|
|||
import sys
|
||||
sys.path[0] = "os"
|
||||
|
||||
dir = "."
|
||||
if "/" in __file__:
|
||||
dir = __file__.rsplit("/", 1)[0]
|
||||
|
||||
sys.path[0] = dir + "/os"
|
||||
from path import *
|
||||
|
||||
assert split("") == ("", "")
|
||||
|
@ -9,9 +14,9 @@ assert split("/foo") == ("/", "foo")
|
|||
assert split("/foo/") == ("/foo", "")
|
||||
assert split("/foo/bar") == ("/foo", "bar")
|
||||
|
||||
assert exists("test_path.py")
|
||||
assert not exists("test_path.py--")
|
||||
assert exists(dir + "/test_path.py")
|
||||
assert not exists(dir + "/test_path.py--")
|
||||
|
||||
assert isdir("os")
|
||||
assert not isdir("os--")
|
||||
assert not isdir("test_path.py")
|
||||
assert isdir(dir + "/os")
|
||||
assert not isdir(dir + "/os--")
|
||||
assert not isdir(dir + "/test_path.py")
|
||||
|
|
Ładowanie…
Reference in New Issue