Skip to content

Commit

Permalink
Introduction to CST
Browse files Browse the repository at this point in the history
  • Loading branch information
EltonCN committed Oct 18, 2024
1 parent 3e6c803 commit d73f62b
Show file tree
Hide file tree
Showing 20 changed files with 623 additions and 0 deletions.
571 changes: 571 additions & 0 deletions examples/Introduction to CST-Python.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ packages = find:

[options.packages.find]
where = src

[options.extras_require]
tests = mypy; testbook; ipython; ipykernel
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added tests/examples/__init__.py
Empty file.
38 changes: 38 additions & 0 deletions tests/examples/test_introduction_to_cst_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import os
import json

from testbook import testbook
from testbook.client import TestbookNotebookClient

from ..utils import get_examples_path

examples_path = get_examples_path()

@testbook(os.path.join(examples_path, "Introduction to CST-Python.ipynb"), execute=True)
def test_introduction(tb :TestbookNotebookClient):
result = tb.cell_output_text("check_interface")
assert result == "True"

result = tb.cell_output_text("basic_memory_members")
assert result == "(0, 'My Memory')"

result = tb.cell_output_text("check_empty_memory")
assert result == "True"

result = tb.cell_output_text("set_info")
assert result == "-1"

result = tb.cell_output_text("check_info_change")
result = eval(result)
assert result[0] == "My Memory's data"

result = tb.cell_output_text("check_codelet_working")
assert result == "1"

result = tb.cell_output_text("check_mind_scheduling")
assert result == "1"

result = tb.cell_output_text("example_change_memory")
assert result == "124"


11 changes: 11 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os
import pathlib


def get_repository_path():
repository_path = pathlib.Path(__file__).parent.parent.resolve()
return repository_path

def get_examples_path():
examples_path = os.path.join(get_repository_path(), "examples")
return examples_path

0 comments on commit d73f62b

Please sign in to comment.