(what: str, min: int, max: int)
| 208 | |
| 209 | def test_range(self): |
| 210 | def test(what: str, min: int, max: int): |
| 211 | req = tutils.tdnsreq() |
| 212 | setattr(req, what, min) |
| 213 | assert getattr(dns.DNSMessage.unpack(req.packed), what) == min |
| 214 | setattr(req, what, min - 1) |
| 215 | with pytest.raises(ValueError): |
| 216 | req.packed |
| 217 | setattr(req, what, max) |
| 218 | assert getattr(dns.DNSMessage.unpack(req.packed), what) == max |
| 219 | setattr(req, what, max + 1) |
| 220 | with pytest.raises(ValueError): |
| 221 | req.packed |
| 222 | |
| 223 | test("id", 0, 2**16 - 1) |
| 224 | test("reserved", 0, 7) |
no test coverage detected