| 1 |
|
| 2 |
u""" |
| 3 |
:Copyright: |
| 4 |
|
| 5 |
Copyright 2019 - 2025 |
| 6 |
Andr\xe9 Malo or his licensors, as applicable |
| 7 |
|
| 8 |
:License: |
| 9 |
|
| 10 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 |
you may not use this file except in compliance with the License. |
| 12 |
You may obtain a copy of the License at |
| 13 |
|
| 14 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
|
| 16 |
Unless required by applicable law or agreed to in writing, software |
| 17 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 18 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 |
See the License for the specific language governing permissions and |
| 20 |
limitations under the License. |
| 21 |
|
| 22 |
===================== |
| 23 |
C ext special tests |
| 24 |
===================== |
| 25 |
|
| 26 |
C ext special tests. |
| 27 |
""" |
| 28 |
__author__ = u"Andr\xe9 Malo" |
| 29 |
|
| 30 |
from pytest import raises |
| 31 |
|
| 32 |
import rjsmin as _rjsmin |
| 33 |
|
| 34 |
|
| 35 |
py_jsmin = _rjsmin._make_jsmin(python_only=True) |
| 36 |
py_jsmin2 = _rjsmin.jsmin_for_posers |
| 37 |
|
| 38 |
import _rjsmin |
| 39 |
|
| 40 |
c_jsmin = _rjsmin.jsmin |
| 41 |
|
| 42 |
from . import _util as _test |
| 43 |
|
| 44 |
|
| 45 |
def test_keep_bang_comments(): |
| 46 |
"""keep_bang_comments argument error""" |
| 47 |
with raises(RuntimeError) as e: |
| 48 |
c_jsmin("", keep_bang_comments=_test.badbool) |
| 49 |
assert e.value.args == ("yoyo",) |
| 50 |
|
| 51 |
|
| 52 |
def test_input_type(): |
| 53 |
"""input type must be a string or bytes""" |
| 54 |
with raises(TypeError): |
| 55 |
c_jsmin(None) |
| 56 |
|
| 57 |
with raises(TypeError): |
| 58 |
py_jsmin(None) |
| 59 |
|
| 60 |
with raises(TypeError): |
| 61 |
py_jsmin2(None) |