add test related to magic commands

This commit is contained in:
fernandocrz 2023-10-30 17:23:05 -03:00
parent 7033f3824d
commit bad810a544
2 changed files with 65 additions and 2 deletions

View File

@ -157,8 +157,6 @@ def get_all_imports(path, encoding="utf-8", extra_ignore_dirs=None, follow_links
continue
else:
logging.error("Failed on file: %s" % file_name)
if filter_ext(file_name, [".ipynb"]) and PythonExporter and not ignore_notebooks:
logging.error("Magic command without % might be failed")
raise exc
# Clean up imports

View File

@ -0,0 +1,65 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Magic test"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%automagic true"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ls -la\n",
"logstate"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ls -la"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%automagic false"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ls -la"
]
}
],
"metadata": {
"language_info": {
"name": "python"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}