old_contents: from .. import api, spec, html
  
  
  def test_render():
      data = dict(x=[1, 2, 3],
                  y=[4, 5, 6])
      spec = api.Viz(data)
      s = spec.encode(x='x:Q', y='y:Q').line()
      r = html.render(s)
      assert r is not None
new_contents: import os
  import tempfile
  import shutil
  import pytest
  from .. import api, spec, html
  
  @pytest.fixture
  def spec():
      data = dict(x=[1, 2, 3], y=[4, 5, 6])
      return api.Viz(data).encode(x='x:Q', y='y:Q').line()
  
  def test_render(spec):
      r = html.render(spec)
      assert r is not None
  
  def test_save(spec, tmpdir):
      fname = tmpdir.join('test.html').dirname
      html.save(spec, fname)
      assert os.path.exists(fname)
  
  def test_save_rename(spec, tmpdir):
      fname = tmpdir.join('test.html').dirname
      html.save(spec, fname)
      assert(os.path.exists(fname + '.html'))
  
  def test_save_overwrite(spec, tmpdir):
      fname = tmpdir.join('test.html').dirname
      html.save(spec, fname)
      html.save(spec, fname, overwrite=True)
      assert(os.path.exists(fname))
  
  def test_save_overwrite_error(spec, tmpdir):
      fname = tmpdir.join('test.html').dirname
      with pytest.raises(ValueError):
          html.save(spec, fname)
          html.save(spec, fname, overwrite=False)
subject: Add tests for saving