1 # Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
3 # Permission to use, copy, modify, and distribute this software and its
4 # documentation for any purpose with or without fee is hereby granted,
5 # provided that the above copyright notice and this permission notice
6 # appear in all copies.
8 # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
9 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
11 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
14 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 class BugsTestCase(unittest
.TestCase
):
25 def test_float_LOC(self
):
26 rdata
= dns
.rdata
.from_text(dns
.rdataclass
.IN
, dns
.rdatatype
.LOC
,
27 "30 30 0.000 N 100 30 0.000 W 10.00m 20m 2000m 20m")
28 self
.failUnless(rdata
.float_latitude
== 30.5)
29 self
.failUnless(rdata
.float_longitude
== -100.5)
31 def test_SOA_BIND8_TTL(self
):
32 rdata1
= dns
.rdata
.from_text(dns
.rdataclass
.IN
, dns
.rdatatype
.SOA
,
33 "a b 100 1s 1m 1h 1d")
34 rdata2
= dns
.rdata
.from_text(dns
.rdataclass
.IN
, dns
.rdatatype
.SOA
,
35 "a b 100 1 60 3600 86400")
36 self
.failUnless(rdata1
== rdata2
)
38 def test_TTL_bounds_check(self
):
40 ttl
= dns
.ttl
.from_text("2147483648")
41 self
.failUnlessRaises(dns
.ttl
.BadTTL
, bad
)
43 if __name__
== '__main__':