Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ rules = ContainmentRules()

# Check if universe can contain system
can_contain = universe.can_contain(system, rules)
# -> False. Containment needs function, scale and boundary to ALL pass, and the
# function check is token overlap (Jaccard): "all" and "organized" share no
# tokens. Give both a shared token (e.g. function="organized all") to get True.

# Create systems and discover interactions
s1 = System(id="s1", function="process", purpose="does work", scale=1.0)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,13 @@ def test_module_entrypoint_outputs_json(self):
report = json.loads(result.stdout)

assert report["status"] == "runnable"


def test_readme_quick_start_containment_results_match_the_documented_comment():
"""README Quick Start documents False for its pair and True with a shared token."""
rules = ContainmentRules()
universe = Container(id="universe", function="all", purpose="contains everything")
system = Container(id="system", function="organized", purpose="organized function")
assert universe.can_contain(system, rules) is False
shared = Container(id="universe", function="organized all", purpose="contains everything")
assert shared.can_contain(system, rules) is True
Loading