diff --git a/tests/test_basic.py b/tests/test_basic.py index 0b1c8be..924692d 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -30,28 +30,30 @@ import os as _os import rjsmin as _rjsmin + # pylint: disable = protected-access py_jsmin = _rjsmin._make_jsmin(python_only=True) py_jsmin2 = _rjsmin.jsmin_for_posers import _rjsmin + c_jsmin = _rjsmin.jsmin def load(name): - """ Load a file """ + """Load a file""" with open(_os.path.join(_os.path.dirname(__file__), name), 'rb') as fp: return fp.read() def save(name, value): - """ Load a file """ + """Load a file""" with open(_os.path.join(_os.path.dirname(__file__), name), 'wb') as fp: fp.write(value) def test_basic(): - """ Test basic.js """ + """Test basic.js""" # pylint: disable = unidiomatic-typecheck inp = load('js/basic.js') @@ -81,7 +83,7 @@ def test_basic(): def test_basic_bang(): - """ Test basic.js with bang comments """ + """Test basic.js with bang comments""" inp = load('js/basic.js') exp = load('js/basic.bang.js') # save('js/basic.bang.js', py_jsmin(inp, keep_bang_comments=True)) diff --git a/tests/test_ctype.py b/tests/test_ctype.py index d2d4499..24701b8 100644 --- a/tests/test_ctype.py +++ b/tests/test_ctype.py @@ -30,25 +30,27 @@ from pytest import raises import rjsmin as _rjsmin + # pylint: disable = protected-access py_jsmin = _rjsmin._make_jsmin(python_only=True) py_jsmin2 = _rjsmin.jsmin_for_posers import _rjsmin + c_jsmin = _rjsmin.jsmin from . import _util as _test def test_keep_bang_comments(): - """ keep_bang_comments argument error """ + """keep_bang_comments argument error""" with raises(RuntimeError) as e: c_jsmin('', keep_bang_comments=_test.badbool) assert e.value.args == ('yoyo',) def test_input_type(): - """ input type must be a string or bytes """ + """input type must be a string or bytes""" with raises(TypeError): c_jsmin(None) diff --git a/tests/test_incomplete.py b/tests/test_incomplete.py index c91ff58..9a28d0f 100644 --- a/tests/test_incomplete.py +++ b/tests/test_incomplete.py @@ -30,28 +30,30 @@ import os as _os import rjsmin as _rjsmin + # pylint: disable = protected-access py_jsmin = _rjsmin._make_jsmin(python_only=True) py_jsmin2 = _rjsmin.jsmin_for_posers import _rjsmin + c_jsmin = _rjsmin.jsmin def load(name): - """ Load a file """ + """Load a file""" with open(_os.path.join(_os.path.dirname(__file__), name), 'rb') as fp: return fp.read() def save(name, value): - """ Load a file """ + """Load a file""" with open(_os.path.join(_os.path.dirname(__file__), name), 'wb') as fp: fp.write(value) def test_string(): - """ Test incomplete string """ + """Test incomplete string""" inp = load('js/incomplete_string.js') exp = load('js/incomplete_string.min.js') # save('js/incomplete_string.min.js', py_jsmin(inp)) @@ -67,7 +69,7 @@ def test_string(): def test_regex(): - """ Test incomplete regex """ + """Test incomplete regex""" inp = load('js/incomplete_regex.js') exp = load('js/incomplete_regex.min.js') # save('js/incomplete_regex.min.js', py_jsmin(inp)) @@ -83,7 +85,7 @@ def test_regex(): def test_regex2(): - """ Test incomplete regex """ + """Test incomplete regex""" inp = load('js/incomplete_regex2.js') exp = load('js/incomplete_regex2.min.js') # save('js/incomplete_regex2.min.js', py_jsmin(inp)) @@ -99,7 +101,7 @@ def test_regex2(): def test_comment(): - """ Test incomplete comment """ + """Test incomplete comment""" inp = load('js/incomplete_comment.js') exp = load('js/incomplete_comment.min.js') # save('js/incomplete_comment.min.js', py_jsmin(inp)) @@ -115,7 +117,7 @@ def test_comment(): def test_comment2(): - """ Test incomplete comment """ + """Test incomplete comment""" inp = load('js/incomplete_comment2.js') exp = load('js/incomplete_comment2.min.js') # save('js/incomplete_comment2.min.js', py_jsmin(inp)) @@ -131,7 +133,7 @@ def test_comment2(): def test_comment_bang(): - """ Test incomplete bang comment """ + """Test incomplete bang comment""" inp = load('js/incomplete_bang_comment.js') exp = load('js/incomplete_bang_comment.min.js') # save('js/incomplete_bang_comment.min.js', @@ -148,7 +150,7 @@ def test_comment_bang(): def test_comment_bang2(): - """ Test incomplete bang comment """ + """Test incomplete bang comment""" inp = load('js/incomplete_bang_comment2.js') exp = load('js/incomplete_bang_comment2.min.js') # save('js/incomplete_bang_comment2.min.js', @@ -165,7 +167,7 @@ def test_comment_bang2(): def test_slash(): - """ Test lone slash """ + """Test lone slash""" inp = load('js/lone_slash.js') exp = load('js/lone_slash.min.js') # save('js/lone_slash.min.js', py_jsmin(inp)) diff --git a/tests/test_issue13.py b/tests/test_issue13.py index 453b2d4..9d26739 100644 --- a/tests/test_issue13.py +++ b/tests/test_issue13.py @@ -30,28 +30,30 @@ import os as _os import rjsmin as _rjsmin + # pylint: disable = protected-access py_jsmin = _rjsmin._make_jsmin(python_only=True) py_jsmin2 = _rjsmin.jsmin_for_posers import _rjsmin + c_jsmin = _rjsmin.jsmin def load(name): - """ Load a file """ + """Load a file""" with open(_os.path.join(_os.path.dirname(__file__), name), 'rb') as fp: return fp.read() def save(name, value): - """ Load a file """ + """Load a file""" with open(_os.path.join(_os.path.dirname(__file__), name), 'wb') as fp: fp.write(value) def test_issue(): - """ Test issue """ + """Test issue""" inp = load('js/issue13.js') exp = load('js/issue13.min.js') # save('js/issue13.min.js', py_jsmin(inp)) @@ -67,7 +69,7 @@ def test_issue(): def test_issue_bang(): - """ Test issue with bang comments """ + """Test issue with bang comments""" inp = load('js/issue13.js') exp = load('js/issue13.bang.js') # save('js/issue13.bang.js', py_jsmin(inp, keep_bang_comments=True)) diff --git a/tests/test_issue17.py b/tests/test_issue17.py index bbdbaed..d42981d 100644 --- a/tests/test_issue17.py +++ b/tests/test_issue17.py @@ -28,16 +28,18 @@ __author__ = u"Andr\xe9 Malo" import rjsmin as _rjsmin + # pylint: disable = protected-access py_jsmin = _rjsmin._make_jsmin(python_only=True) py_jsmin2 = _rjsmin.jsmin_for_posers import _rjsmin + c_jsmin = _rjsmin.jsmin def test_non_issue(): - """ Test issue """ + """Test issue""" inp = b'console.write((f++)/ 4 + 3 / 2)' exp = b'console.write((f++)/4+3/2)' @@ -53,7 +55,7 @@ def test_non_issue(): def test_non_issue_bang(): - """ Test issue with bang comments """ + """Test issue with bang comments""" inp = b'console.write((f++)/ 4 + 3 / 2)' exp = b'console.write((f++)/4+3/2)' @@ -69,11 +71,15 @@ def test_non_issue_bang(): def test_non_issue2(): - """ Test issue """ - inp = (b'if (Y) { ba=Math.max(ba, Math.round(W.minHeight/Y))}; ' - b'bo.setKnobFactor((bp.width===0)? 0: br.width /bp.width);') - exp = (b'if(Y){ba=Math.max(ba,Math.round(W.minHeight/Y))};' - b'bo.setKnobFactor((bp.width===0)?0:br.width/bp.width);') + """Test issue""" + inp = ( + b'if (Y) { ba=Math.max(ba, Math.round(W.minHeight/Y))}; ' + b'bo.setKnobFactor((bp.width===0)? 0: br.width /bp.width);' + ) + exp = ( + b'if(Y){ba=Math.max(ba,Math.round(W.minHeight/Y))};' + b'bo.setKnobFactor((bp.width===0)?0:br.width/bp.width);' + ) assert py_jsmin(inp) == exp assert py_jsmin2(inp) == exp @@ -87,11 +93,15 @@ def test_non_issue2(): def test_non_issue2_bang(): - """ Test issue """ - inp = (b'if (Y) { ba=Math.max(ba, Math.round(W.minHeight/Y))}; ' - b'bo.setKnobFactor((bp.width===0)? 0: br.width /bp.width);') - exp = (b'if(Y){ba=Math.max(ba,Math.round(W.minHeight/Y))};' - b'bo.setKnobFactor((bp.width===0)?0:br.width/bp.width);') + """Test issue""" + inp = ( + b'if (Y) { ba=Math.max(ba, Math.round(W.minHeight/Y))}; ' + b'bo.setKnobFactor((bp.width===0)? 0: br.width /bp.width);' + ) + exp = ( + b'if(Y){ba=Math.max(ba,Math.round(W.minHeight/Y))};' + b'bo.setKnobFactor((bp.width===0)?0:br.width/bp.width);' + ) assert py_jsmin(inp, keep_bang_comments=True) == exp assert py_jsmin2(inp, keep_bang_comments=True) == exp @@ -105,9 +115,11 @@ def test_non_issue2_bang(): def test_non_issue_complex(): - """ Test issue """ - inp = (b'console.write((f++)/*!dude*// 4 + 3 /a /* lalala */ ' - b'/*!lololo*// 2)') + """Test issue""" + inp = ( + b'console.write((f++)/*!dude*// 4 + 3 /a /* lalala */ ' + b'/*!lololo*// 2)' + ) exp = b'console.write((f++)/4+3/a/2)' assert py_jsmin(inp) == exp @@ -122,9 +134,11 @@ def test_non_issue_complex(): def test_non_issue_complex_bang(): - """ Test issue with bang comments """ - inp = (b'console.write((f++)/*!dude*// 4 + 3 /a /* lalala */ ' - b'/*!lololo*// 2)') + """Test issue with bang comments""" + inp = ( + b'console.write((f++)/*!dude*// 4 + 3 /a /* lalala */ ' + b'/*!lololo*// 2)' + ) exp = b'console.write((f++)/*!dude*//4+3/a/*!lololo*//2)' assert py_jsmin(inp, keep_bang_comments=True) == exp @@ -139,7 +153,7 @@ def test_non_issue_complex_bang(): def test_issue(): - """ Test issue """ + """Test issue""" inp = b'for(f=0;f