mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
tests: add Filename unit tests for fspath protocol in particular
This commit is contained in:
parent
ba1023efa9
commit
7f7cbd1c25
24
tests/dtoolutil/test_filename.py
Normal file
24
tests/dtoolutil/test_filename.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
from panda3d.core import Filename
|
||||||
|
import sys, os
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6")
|
||||||
|
def test_filename_fspath():
|
||||||
|
fn = Filename.from_os_specific(__file__)
|
||||||
|
assert os.fspath(fn) == fn.to_os_specific_w()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6")
|
||||||
|
def test_filename_open():
|
||||||
|
fn = Filename.from_os_specific(__file__)
|
||||||
|
open(fn, 'rb')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.version_info < (3, 4), reason="Requires Python 3.4")
|
||||||
|
def test_filename_ctor_pathlib():
|
||||||
|
pathlib = pytest.importorskip('pathlib')
|
||||||
|
|
||||||
|
path = pathlib.Path(__file__)
|
||||||
|
fn = Filename(path)
|
||||||
|
assert fn.to_os_specific_w() == str(path)
|
Loading…
x
Reference in New Issue
Block a user