Support nested imports, closes #351

This commit is contained in:
Simon Willison 2021-12-10 16:11:22 -08:00
commit 7a43af232e
3 changed files with 28 additions and 1 deletions

View file

@ -93,6 +93,27 @@ def test_convert_import(test_db_and_path):
] == list(db["example"].rows)
def test_convert_import_nested(fresh_db_and_path):
db, db_path = fresh_db_and_path
db["example"].insert({"xml": '<item name="Cleo" />'})
result = CliRunner().invoke(
cli.cli,
[
"convert",
db_path,
"example",
"xml",
'xml.etree.ElementTree.fromstring(value).attrib["name"]',
"--import",
"xml.etree.ElementTree",
],
)
assert 0 == result.exit_code, result.output
assert [
{"xml": "Cleo"},
] == list(db["example"].rows)
def test_convert_dryrun(test_db_and_path):
db, db_path = test_db_and_path
result = CliRunner().invoke(