MCPcopy
hub / github.com/Knio/dominate / test_attributes

Function test_attributes

tests/test_html.py:201–221  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199
200
201def test_attributes():
202 d = div()
203 d['id'] = 'foo'
204 assert d['id'] == 'foo'
205 del d['id']
206 with pytest.raises(KeyError):
207 del d['id']
208 with pytest.raises(AttributeError):
209 x = d['id']
210
211 with div() as d:
212 attr(data_test=False)
213 assert d['data-test'] is False
214
215 with div() as d:
216 attr(data_test=True)
217 assert d['data-test']
218
219 with pytest.raises(ValueError):
220 # not in a tag context
221 attr(id='moo')
222
223
224def test_attribute_none():

Callers

nothing calls this directly

Calls 2

divClass · 0.85
attrFunction · 0.85

Tested by

no test coverage detected