MCPcopy Create free account
hub / github.com/idank/explainshell / test_positional_on_positional_ok

Method test_positional_on_positional_ok

tests/test_db_check.py:131–155  ·  view source on GitHub ↗

Positional operands (no flags) with positional set should not warn.

(self, store, db_path)

Source from the content-addressed store, hash-verified

129 assert any("positional on flagged option" in msg for msg in warnings)
130
131 def test_positional_on_positional_ok(self, store, db_path):
132 """Positional operands (no flags) with positional set should not warn."""
133 opts = json.dumps(
134 [
135 {
136 "text": "FILE desc",
137 "short": [],
138 "long": [],
139 "has_argument": False,
140 "positional": "FILE",
141 "nested_cmd": False,
142 }
143 ]
144 )
145 store._conn.execute("PRAGMA foreign_keys = OFF")
146 store._conn.execute(
147 "INSERT INTO parsed_manpages(source, name, options, aliases) "
148 "VALUES (?, ?, ?, '[]')",
149 ("ubuntu/26.04/1/cat.1.gz", "cat", opts),
150 )
151 store._conn.commit()
152 store._conn.execute("PRAGMA foreign_keys = ON")
153 issues = db_check(db_path)
154 warnings = [msg for sev, msg in issues if sev == "warning"]
155 assert not any("argument on flagged option" in msg for msg in warnings)
156
157 def test_stale_subcommand_mapping_missing_parent(self, store, db_path):
158 """Subcommand mapping whose parent doesn't exist should be an error."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected