def test_output_file(): s = state.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
def test_output_file(self): s = state.State() s.output_file("foo.html") self.assertEqual(s.file['filename'], "foo.html") self.assertEqual(s.file['title'], "Bokeh Plot") self.assertEqual(s.file['resources'].log_level, 'info') self.assertEqual(s.file['resources'].minified, True)
def test_creation(): s = state.State() assert isinstance(s.document, Document) assert s.url == "http://localhost:5006/" assert s.file == None assert s.notebook == False assert s.server_enabled == False assert GENERATED_SESSION_ID_LEN == len(s.session_id)
def test_reset(): s = state.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
def test_output_server(self): s = state.State() self.assertEqual(GENERATED_SESSION_ID_LEN, len(s.session_id)) s.output_server() self.assertEqual(s.session_id, "default") self.assertEqual(s.server_url + "/", DEFAULT_SERVER_HTTP_URL) self.assertEqual(s.app_path, '/') s.output_server("foo") self.assertEqual(s.session_id, "foo") self.assertEqual(s.server_url + "/", DEFAULT_SERVER_HTTP_URL) self.assertEqual(s.app_path, '/')
def test_reset(self): s = state.State() d = s.document s.output_file("foo.html") s.output_server("default") s.output_notebook() s.reset() self.assertEqual(s.file, None) self.assertEqual(s.notebook, False) self.assertEqual(GENERATED_SESSION_ID_LEN, len(s.session_id)) self.assertTrue(isinstance(s.document, Document)) self.assertTrue(s.document != d)
def test_output_file_file_exists(self, mock_isfile, mock_logger): mock_isfile.return_value = True s = state.State() s.output_file("foo.html") self.assertEqual(s.file['filename'], "foo.html") self.assertEqual(s.file['title'], "Bokeh Plot") self.assertEqual(s.file['resources'].log_level, 'info') self.assertEqual(s.file['resources'].minified, True) self.assertTrue(state.logger.info.called) self.assertEqual(state.logger.info.call_args[0], ( "Session output file 'foo.html' already exists, will be overwritten.", ))
def test_output_file_file_exists(mock_isfile, mock_logger): mock_isfile.return_value = True s = state.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 state.logger.info.called assert state.logger.info.call_args[0] == ( "Session output file 'foo.html' already exists, will be overwritten.", )
def test_reset(): s = state.State() d = s.document s.output_file("foo.html") s.output_server("default") s.output_notebook() s.reset() assert s.file == None assert s.notebook == False assert s.server_enabled == False assert GENERATED_SESSION_ID_LEN == len(s.session_id) assert isinstance(s.document, Document) assert s.document != d
def test_output_server(): s = state.State() assert GENERATED_SESSION_ID_LEN == len(s.session_id) assert s.server_enabled == False s.output_server() assert s.session_id == "default" assert s.session_id_allowing_none == "default" assert s.server_url + "/" == DEFAULT_SERVER_HTTP_URL assert s.app_path == '/' assert s.server_enabled == True s.output_server("foo") assert s.session_id == "foo" assert s.session_id_allowing_none == "foo" assert s.server_url + "/" == DEFAULT_SERVER_HTTP_URL assert s.app_path == '/' assert s.server_enabled == True
def test_output_notebook_noarg(): s = state.State() s.output_notebook() assert s.notebook == True
def test_creation(self): s = state.State() self.assertTrue(isinstance(s.document, Document)) self.assertEqual(s.file, None) self.assertEqual(s.notebook, False) self.assertEqual(GENERATED_SESSION_ID_LEN, len(s.session_id))
def test_default_file_resources(self): s = state.State() s.output_file("foo.html") self.assertEqual(s.file['resources'].minified, True)
def test_default_file_resources(): s = state.State() s.output_file("foo.html") assert s.file['resources'].minified, True
def test_creation(): s = state.State() assert isinstance(s.document, Document) assert s.file == None assert s.notebook == False
def test_output_invalid_notebook(): s = state.State() with pytest.raises(Exception) as ex: s.notebook_type = "invalid_notebook" assert "Unknown notebook type 'invalid_notebook', valid notebook types are: jupyter, zeppelin" == str( ex.value)
def test_output_notebook_witharg(): s = state.State() s.output_notebook(notebook_type='zeppelin') assert s.notebook == True assert s.notebook_type == 'zeppelin'
def test_output_notebook_noarg(): s = state.State() s.output_notebook() assert s.notebook == True assert s.notebook_type == 'jupyter'
def test_output_notebook_noarg(self): s = state.State() s.output_notebook() self.assertEqual(GENERATED_SESSION_ID_LEN, len(s.session_id)) self.assertEqual(s.notebook, True)
def test_output_notebook_noarg(): s = state.State() s.output_notebook() assert GENERATED_SESSION_ID_LEN == len(s.session_id) assert s.notebook == True
def test_doc_set(): s = state.State() d = Document() s.document = d assert isinstance(s.document, Document) assert s.document == d
def test_output_invalid_notebook(): s = state.State() with pytest.raises(Exception): s.notebook_type = None with pytest.raises(Exception): s.notebook_type = 10