TST: test json flag in magics
@@ -80,10 +80,11 @@ def test_vegalite_magic_data_included():
assert VEGALITE_SPEC == result.result.spec
-def test_vega_magic_data_included():
- result = _ipshell.run_cell('%%vega\n' + json.dumps(VEGA_SPEC))
- assert isinstance(result.result, Vega)
- assert VEGA_SPEC == result.result.spec
+def test_vegalite_magic_json_flag():
+ result = _ipshell.run_cell('%%vegalite --json\n'
+ + json.dumps(VEGALITE_SPEC))
+ assert isinstance(result.result, VegaLite)
+ assert VEGALITE_SPEC == result.result.spec
def test_vegalite_magic_pandas_data():
@@ -93,6 +94,18 @@ def test_vegalite_magic_pandas_data():
assert VEGALITE_SPEC == result.result.spec
+def test_vega_magic_data_included():
+ result = _ipshell.run_cell('%%vega\n' + json.dumps(VEGA_SPEC))
+ assert isinstance(result.result, Vega)
+ assert VEGA_SPEC == result.result.spec
+
+
+def test_vega_magic_json_flag():
+ result = _ipshell.run_cell('%%vega --json\n' + json.dumps(VEGA_SPEC))
+ assert isinstance(result.result, Vega)
+ assert VEGA_SPEC == result.result.spec
+
+
def test_vega_magic_pandas_data():
spec = {key: val for key, val in VEGA_SPEC.items() if key != 'data'}
result = _ipshell.run_cell('%%vega table\n' + json.dumps(spec))
