diff --git a/flask_bootstrap/__init__.py b/flask_bootstrap/__init__.py index 4cefb120..56fcfdd5 100644 --- a/flask_bootstrap/__init__.py +++ b/flask_bootstrap/__init__.py @@ -10,7 +10,7 @@ def is_hidden_field_filter(field): return isinstance(field, HiddenField) -def raise_helper(message): # pragma: no cover +def raise_helper(message): raise RuntimeError(message) @@ -23,7 +23,7 @@ def get_table_titles(data, primary_key, primary_key_title): return [] titles = [] for k in data[0].__table__.columns.keys(): - if not k.startswith('_'): + if not k.startswith('_'): # pragma: no branch titles.append((k, k.replace('_', ' ').title())) titles[0] = (primary_key, primary_key_title) return titles @@ -50,13 +50,13 @@ class _Bootstrap: popper_filename = 'popper.min.js' def __init__(self, app=None): - if app is not None: + if app is not None: # pragma: no branch self.init_app(app) def init_app(self, app): if not hasattr(app, 'extensions'): - app.extensions = {} + app.extensions = {} # pragma: no cover app.extensions['bootstrap'] = self blueprint = Blueprint('bootstrap', __name__, static_folder=f'static/{self.static_folder}', diff --git a/tests/test_bootstrap4/test_bootstrap.py b/tests/test_bootstrap4/test_bootstrap.py index 4d5599db..f4749faa 100644 --- a/tests/test_bootstrap4/test_bootstrap.py +++ b/tests/test_bootstrap4/test_bootstrap.py @@ -1,10 +1,14 @@ import pytest from flask import current_app, render_template_string -from flask_bootstrap import CDN_BASE +from flask_bootstrap import CDN_BASE, raise_helper @pytest.mark.usefixtures('client') class TestBootstrap: + def test_raise_helper(self): + with pytest.raises(RuntimeError, match='Test message'): + raise_helper('Test message') + def test_deprecate_bootstrap_class(self): from flask_bootstrap import Bootstrap from flask import Flask diff --git a/tests/test_bootstrap4/test_render_table.py b/tests/test_bootstrap4/test_render_table.py index 2efc87dd..c94881ef 100644 --- a/tests/test_bootstrap4/test_render_table.py +++ b/tests/test_bootstrap4/test_render_table.py @@ -193,7 +193,6 @@ def test(): assert '
# | ' in data assert 'Text | ' in data - assert 'Text | ' in data assert '1 | ' in data assert 'Test message 1 | ' in data
---|