-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test coverage to the codespell utility
- Loading branch information
Alex Lee
committed
Sep 9, 2024
1 parent
4d26e6d
commit df16e4b
Showing
7 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"print(f\"{os.__file}__\")\n", | ||
"\n", | ||
"# Speling mistake." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2024 The PyMC Labs Developers | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Notebook to markdown tests.""" | ||
|
||
import os | ||
from tempfile import TemporaryDirectory | ||
|
||
import pytest | ||
from notebook_to_markdown import notebook_to_markdown | ||
|
||
|
||
@pytest.fixture | ||
def data_dir() -> str: | ||
"""Get current directory.""" | ||
return os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_data") | ||
|
||
|
||
def test_notebook_to_markdown_empty_pattern(data_dir: str) -> None: | ||
"""Test basic functionality of notebook_to_markdown with empty pattern.""" | ||
with TemporaryDirectory() as tmp_dir: | ||
pattern = "*.missing" | ||
notebook_to_markdown(f"{data_dir}/{pattern}", tmp_dir) | ||
assert len(os.listdir(tmp_dir)) == 0 | ||
|
||
|
||
def test_notebook_to_markdown(data_dir: str) -> None: | ||
"""Test basic functionality of notebook_to_markdown with a correct pattern.""" | ||
with TemporaryDirectory() as tmp_dir: | ||
pattern = "*.ipynb" | ||
notebook_to_markdown(f"{data_dir}/{pattern}", tmp_dir) | ||
assert len(os.listdir(tmp_dir)) == 1 | ||
assert "test_notebook.md" in os.listdir(tmp_dir) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.