Skip to content

Commit

Permalink
Example: Implementing a Architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
EltonCN committed Oct 18, 2024
1 parent 2065cb3 commit 321b63b
Show file tree
Hide file tree
Showing 9 changed files with 773 additions and 0 deletions.
513 changes: 513 additions & 0 deletions examples/Implementing a Architecture.ipynb

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions examples/Implementing a Architecture/.$diagram.drawio.bkp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<mxfile host="Electron" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.7.17 Chrome/128.0.6613.36 Electron/32.0.1 Safari/537.36" version="24.7.17">
<diagram name="Página-1" id="v86uxaaGLmw6JI9T3la1">
<mxGraphModel dx="864" dy="508" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
</root>
</mxGraphModel>
</diagram>
</mxfile>
Binary file added examples/Implementing a Architecture/Codelet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
213 changes: 213 additions & 0 deletions examples/Implementing a Architecture/diagram.drawio

Large diffs are not rendered by default.

Binary file added examples/Implementing a Architecture/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions tests/examples/test_implementing_a_architecture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import math

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, "Implementing a Architecture.ipynb"), execute=True)
def test_implementing_architecture(tb :TestbookNotebookClient):
expected_results : list[list] = [["nan", "nan"],
[0, 0],
[-0, 2],
[3,3]]

for i, excepted_result in enumerate(expected_results):
result = tb.cell_output_text(f"equation{i+1}")
result = result.replace("nan", "'nan'")
result = eval(result)

for x in result:
for y in excepted_result:
if isinstance(x, str) or isinstance(y,str):
if isinstance(x, str) and isinstance(y,str) and x == y:
excepted_result.remove(y)
break

elif math.isclose(x, y):
excepted_result.remove(y)
break

assert len(excepted_result) == 0



0 comments on commit 321b63b

Please sign in to comment.