Skip to content

Commit

Permalink
fix: typo in run subs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmadisetti committed Dec 27, 2024
1 parent fda938f commit 7e72191
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion marimo/_runtime/dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def _get_ancestors(
) -> set[CellId_t]:
# Get the transitive closure of parents defining unsubstituted refs
graph = self._graph
substitutions = set(kwargs.values())
substitutions = set(kwargs.keys())
unsubstituted_refs = cell_impl.refs - substitutions
parent_ids = set(
[
Expand Down
20 changes: 20 additions & 0 deletions tests/_ast/cell_data/named_cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,25 @@ def h(y):
return (z,)


@app.cell
def unhashable_defined():
unhashable = {0, 1, 2}
unhashable
return (unhashable,)


@app.cell
def unhashable_required(unhashable):
assert unhashable == {0, 1}
return


@app.cell
def multiple():
A = 0
B = 1
(A, B)
return (A, B)

if __name__ == "__main__":
app.run()
24 changes: 24 additions & 0 deletions tests/_ast/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,30 @@ def test_import() -> None:
assert g.run(x=1) == (None, {"y": 2})
assert h.run(y=2) == (3, {"z": 3})

@staticmethod
def test_unhashable_import() -> None:
from cell_data.named_cells import (
unhashable_defined,
unhashable_required,
)

assert unhashable_defined.name == "unhashable_defined"
assert unhashable_required.name == "unhashable_required"

unhashable_required.run(unhashable={0, 1})
assert unhashable_defined.run() == (
{0, 1, 2},
{"unhashable": {0, 1, 2}},
)

@staticmethod
def test_direct_call() -> None:
from cell_data.named_cells import h, multiple, unhashable_defined

assert h(1) == 2
assert multiple() == (0, 1)
assert unhashable_defined() == {0, 1, 2}


def help_smoke() -> None:
app = App()
Expand Down

0 comments on commit 7e72191

Please sign in to comment.