예제 #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
예제 #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
예제 #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()
예제 #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
예제 #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.",
     )
예제 #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.",
     )
예제 #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
예제 #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'
예제 #9
0
 def test_output_notebook_noarg(self):
     s = bis.State()
     s.output_notebook()
     assert s.notebook == True
     assert s.notebook_type == 'jupyter'
예제 #10
0
 def test_default_file_resources(self):
     s = bis.State()
     s.output_file("foo.html")
     assert s.file['resources'].minified, True
예제 #11
0
 def test_creation(self):
     s = bis.State()
     assert isinstance(s.document, Document)
     assert s.file == None
     assert s.notebook == False
예제 #12
0
 def test_doc_set(self):
     s = bis.State()
     d = Document()
     s.document = d
     assert isinstance(s.document, Document)
     assert s.document == d
예제 #13
0
 def test_default_file_resources(self) -> None:
     s = bis.State()
     s.output_file("foo.html")
     assert s.file.resources.minified, True
예제 #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