44import xml .dom .minidom
55import warnings
66
7+ import pytest
8+
79import cssutils
810
911
10- class TestDOMImplementation :
11- def setup_method ( self ):
12- self . domimpl = cssutils .DOMImplementationCSS ()
12+ @ pytest . fixture
13+ def domimpl ( ):
14+ return cssutils .DOMImplementationCSS ()
1315
14- def test_createCSSStyleSheet (self ):
16+
17+ class TestDOMImplementation :
18+ def test_createCSSStyleSheet (self , domimpl ):
1519 "DOMImplementationCSS.createCSSStyleSheet()"
1620 title , media = 'Test Title' , cssutils .stylesheets .MediaList ('all' )
1721 with warnings .catch_warnings ():
1822 warnings .simplefilter ('ignore' )
19- sheet = self . domimpl .createCSSStyleSheet (title , media )
23+ sheet = domimpl .createCSSStyleSheet (title , media )
2024 assert isinstance (sheet , cssutils .css .CSSStyleSheet )
2125 assert title == sheet .title
2226 assert media == sheet .media
2327
24- def test_createDocument (self ):
28+ def test_createDocument (self , domimpl ):
2529 "DOMImplementationCSS.createDocument()"
26- doc = self . domimpl .createDocument (None , None , None )
30+ doc = domimpl .createDocument (None , None , None )
2731 assert isinstance (doc , xml .dom .minidom .Document )
2832
29- def test_createDocumentType (self ):
33+ def test_createDocumentType (self , domimpl ):
3034 "DOMImplementationCSS.createDocumentType()"
31- doctype = self . domimpl .createDocumentType ('foo' , 'bar' , 'raboof' )
35+ doctype = domimpl .createDocumentType ('foo' , 'bar' , 'raboof' )
3236 assert isinstance (doctype , xml .dom .minidom .DocumentType )
3337
34- def test_hasFeature (self ):
38+ def test_hasFeature (self , domimpl ):
3539 "DOMImplementationCSS.hasFeature()"
3640 tests = [
3741 ('css' , '1.0' ),
@@ -40,4 +44,4 @@ def test_hasFeature(self):
4044 ('stylesheets' , '2.0' ),
4145 ]
4246 for name , version in tests :
43- assert self . domimpl .hasFeature (name , version )
47+ assert domimpl .hasFeature (name , version )
0 commit comments