Skip to content

Commit

Permalink
Use pytest.raises for simplicity.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 11, 2021
1 parent c7278dc commit 736f757
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cssutils/tests/test_profiles.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Testcases for cssutils.css.CSSValue and CSSPrimitiveValue."""

import sys
from . import basetest
import re

import pytest

import cssutils
from . import basetest

CSS2 = (cssutils.profile.CSS_LEVEL_2,)
C3BUI = (cssutils.profile.CSS3_BASIC_USER_INTERFACE,)
Expand Down Expand Up @@ -114,10 +117,9 @@ def test_addProfile(self):

cssutils.log.raiseExceptions = True

expmsg = "invalid literal for int() with base 10: 'x'"
self.assertRaisesMsg(
Exception, expmsg, cssutils.profile.validate, '-test-funcval', 'x'
)
expmsg = re.escape("invalid literal for int() with base 10: 'x'")
with pytest.raises(Exception, match=expmsg):
cssutils.profile.validate('-test-funcval', 'x')

def test_removeProfile(self):
"Profiles.removeProfile()"
Expand Down

0 comments on commit 736f757

Please sign in to comment.