Uploaded Test files
This commit is contained in:
parent
f584ad9d97
commit
2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions
32
venv/Lib/site-packages/nbformat/v3/tests/test_misc.py
Normal file
32
venv/Lib/site-packages/nbformat/v3/tests/test_misc.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
from .. import parse_filename
|
||||
|
||||
|
||||
class MiscTests(TestCase):
|
||||
|
||||
def check_filename(self, path, exp_fname, exp_bname, exp_format):
|
||||
fname, bname, format = parse_filename(path)
|
||||
self.assertEqual(fname, exp_fname)
|
||||
self.assertEqual(bname, exp_bname)
|
||||
self.assertEqual(format, exp_format)
|
||||
|
||||
def test_parse_filename(self):
|
||||
|
||||
# check format detection
|
||||
self.check_filename("test.ipynb", "test.ipynb", "test", "json")
|
||||
self.check_filename("test.json", "test.json", "test", "json")
|
||||
self.check_filename("test.py", "test.py", "test", "py")
|
||||
|
||||
# check parsing an unknown format
|
||||
self.check_filename("test.nb", "test.nb.ipynb", "test.nb", "json")
|
||||
|
||||
# check parsing a full file path
|
||||
abs_path = os.path.abspath("test.ipynb")
|
||||
basename, ext = os.path.splitext(abs_path)
|
||||
self.check_filename(abs_path, abs_path, basename, "json")
|
||||
|
||||
# check parsing a file name containing dots
|
||||
self.check_filename("test.nb.ipynb", "test.nb.ipynb", "test.nb",
|
||||
"json")
|
Loading…
Add table
Add a link
Reference in a new issue