()
| 199 | |
| 200 | |
| 201 | def 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 | |
| 224 | def test_attribute_none(): |