Example #1
0
 def test_output_file(self) -> None:
     s = bis.State()
     s.output_file("foo.html")
     assert s.file.filename == "foo.html"
     assert s.file.title == "Bokeh Plot"
     assert s.file.resources.log_level == 'info'
     assert s.file.resources.minified == True
Example #2
0
 def test_output_file(self):
     s = bis.State()
     s.output_file("foo.html")
     assert s.file['filename'] == "foo.html"
     assert s.file['title'] == "Bokeh Plot"
     assert s.file['resources'].log_level == 'info'
     assert s.file['resources'].minified == True
Example #3
0
def clear_bokeh_memory():
    """Run garbage collection after bokeh plots in
    an attempt to reduce memory usage
    """
    curdoc().clear()
    state.State().reset()
    reset_output()
    gc.collect()
Example #4
0
 def test_reset(self):
     s = bis.State()
     d = s.document
     s.output_file("foo.html")
     s.output_notebook()
     s.reset()
     assert s.file == None
     assert s.notebook == False
     assert isinstance(s.document, Document)
     assert s.document != d
Example #5
0
 def test_output_file_file_exists(self, mock_isfile, mock_log):
     mock_isfile.return_value = True
     s = bis.State()
     s.output_file("foo.html")
     assert s.file['filename'] == "foo.html"
     assert s.file['title'] == "Bokeh Plot"
     assert s.file['resources'].log_level == 'info'
     assert s.file['resources'].minified == True
     assert mock_log.info.call_count == 1
     assert mock_log.info.call_args[0] == (
         "Session output file 'foo.html' already exists, will be overwritten.",
     )
Example #6
0
 def test_output_file_file_exists(self, mock_isfile: MagicMock,
                                  mock_log: MagicMock) -> None:
     mock_isfile.return_value = True
     s = bis.State()
     s.output_file("foo.html")
     assert s.file.filename == "foo.html"
     assert s.file.title == "Bokeh Plot"
     assert s.file.resources.log_level == 'info'
     assert s.file.resources.minified is True
     assert mock_log.info.call_count == 1
     assert mock_log.info.call_args[0] == (
         "Session output file 'foo.html' already exists, will be overwritten.",
     )
Example #7
0
 def test_output_invalid_notebook(self):
     s = bis.State()
     with pytest.raises(Exception):
         s.notebook_type = None
     with pytest.raises(Exception):
         s.notebook_type = 10
Example #8
0
 def test_output_notebook_witharg(self):
     s = bis.State()
     s.output_notebook(notebook_type='notjup')
     assert s.notebook == True
     assert s.notebook_type == 'notjup'
Example #9
0
 def test_output_notebook_noarg(self):
     s = bis.State()
     s.output_notebook()
     assert s.notebook == True
     assert s.notebook_type == 'jupyter'
Example #10
0
 def test_default_file_resources(self):
     s = bis.State()
     s.output_file("foo.html")
     assert s.file['resources'].minified, True
Example #11
0
 def test_creation(self):
     s = bis.State()
     assert isinstance(s.document, Document)
     assert s.file == None
     assert s.notebook == False
Example #12
0
 def test_doc_set(self):
     s = bis.State()
     d = Document()
     s.document = d
     assert isinstance(s.document, Document)
     assert s.document == d
Example #13
0
 def test_default_file_resources(self) -> None:
     s = bis.State()
     s.output_file("foo.html")
     assert s.file.resources.minified, True
Example #14
0
 def test_creation(self) -> None:
     s = bis.State()
     assert isinstance(s.document, Document)
     assert s.file is None
     assert s.notebook is False