summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBob Halley <halley@play-bow.org>2015-05-21 05:43:15 -0700
committerBob Halley <halley@play-bow.org>2015-05-21 05:43:15 -0700
commit2eaf67ae39bb7c8b1363b16736d7054a8c0fd967 (patch)
tree70bbadb89d5c9b5d388200b37f2b0134752304a1 /tests
parent1616939677dd1115539519fe645b15abf4623bb1 (diff)
parent8646a0410cefa18485fc1f8eaebb7faa2c964ccf (diff)
downloaddnspython-2eaf67ae39bb7c8b1363b16736d7054a8c0fd967.tar.gz
Merge pull request #97 from encukou/zone-to_file
Fix failing test for Zone.to_file
Diffstat (limited to 'tests')
-rw-r--r--tests/test_zone.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_zone.py b/tests/test_zone.py
index 67fc2ae..08557ad 100644
--- a/tests/test_zone.py
+++ b/tests/test_zone.py
@@ -121,12 +121,25 @@ class ZoneTestCase(unittest.TestCase):
os.unlink('example2.out')
self.assertTrue(ok)
+ def testFromFile2b(self):
+ """Test to_file with a binary file"""
+ z = dns.zone.from_file('example', 'example', relativize=False)
+ ok = False
+ try:
+ with open('example2b.out', 'wb') as f:
+ z.to_file(f, relativize=False, nl='\x0a', binary=True)
+ ok = filecmp.cmp('example2b.out', 'example2.good')
+ finally:
+ if not _keep_output:
+ os.unlink('example2b.out')
+ self.assertTrue(ok)
+
def testToText(self):
z = dns.zone.from_file('example', 'example')
ok = False
try:
text_zone = z.to_text(nl='\x0a')
- f = open('example3.out', 'wb')
+ f = open('example3.out', 'w')
f.write(text_zone)
f.close()
ok = filecmp.cmp('example3.out', 'example3.good')