Skip to content

Commit 0d3f42b

Browse files
Gallaeciokmike
andauthored
Cover the GenericTranslator in the automated tests (#162)
Co-Authored-By: Mikhail Korobov <[email protected]>
1 parent 15e4326 commit 0d3f42b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/test_selector_csstranslator.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Selector tests for cssselect backend
33
"""
44
import unittest
5-
from parsel.csstranslator import HTMLTranslator
5+
from parsel.csstranslator import GenericTranslator, HTMLTranslator
66
from parsel import Selector
77
from cssselect.parser import SelectorSyntaxError
88
from cssselect.xpath import ExpressionError
@@ -44,9 +44,7 @@
4444
'''
4545

4646

47-
class TranslatorMixinTest(unittest.TestCase):
48-
49-
tr_cls = HTMLTranslator
47+
class TranslatorTestMixin:
5048

5149
def setUp(self):
5250
self.tr = self.tr_cls()
@@ -113,6 +111,14 @@ def test_unknown_pseudo_class(self):
113111
self.assertRaises(exc, self.c2x, css)
114112

115113

114+
class HTMLTranslatorTest(TranslatorTestMixin, unittest.TestCase):
115+
tr_cls = HTMLTranslator
116+
117+
118+
class GenericTranslatorTest(TranslatorTestMixin, unittest.TestCase):
119+
tr_cls = GenericTranslator
120+
121+
116122
class UtilCss2XPathTest(unittest.TestCase):
117123
def test_css2xpath(self):
118124
from parsel import css2xpath

0 commit comments

Comments
 (0)