Skip to content

Commit

Permalink
Edited test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hMatoba committed Feb 5, 2015
1 parent 5f4ed41 commit 71fdb8d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion piexif/_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ._common import *


def remove(src, new_file=""):
def remove(src, new_file=None):
"""
py:function:: piexif.remove(filename)
Expand Down
33 changes: 28 additions & 5 deletions tests/s_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def test_transplant(self):

with self.assertRaises(ValueError):
piexif.transplant(NOEXIF_FILE, INPUT_FILE2, "foo.jpg")
os.remove("transplant.jpg")

def test_transplant_m(self):
"""'transplant' on memory.
Expand All @@ -193,12 +194,33 @@ def test_remove(self):
piexif.remove(INPUT_FILE1, "remove.jpg")
exif_dict = piexif.load("remove.jpg")
none_dict = {"0th":{},
"Exif":{},
"GPS":{},
"Interop":{},
"1st":{},
"thumbnail":None}
"Exif":{},
"GPS":{},
"Interop":{},
"1st":{},
"thumbnail":None}
self.assertEqual(exif_dict, none_dict)

piexif.remove("remove.jpg")
exif_dict = piexif.load("remove.jpg")
self.assertEqual(exif_dict, none_dict)
os.remove("remove.jpg")

def test_remove2(self):
with open(INPUT_FILE1, "rb") as f:
data = f.read()
with open("remove2.jpg", "wb+") as f:
f.write(data)
piexif.remove("remove2.jpg")
exif_dict = piexif.load("remove2.jpg")
none_dict = {"0th":{},
"Exif":{},
"GPS":{},
"Interop":{},
"1st":{},
"thumbnail":None}
self.assertEqual(exif_dict, none_dict)
os.remove("remove2.jpg")

def test_remove_m(self):
"""'remove' on memory.
Expand Down Expand Up @@ -257,6 +279,7 @@ def test_insert(self):
piexif.insert(b"dummy", io.BytesIO())

piexif.insert(exif_bytes, "insert.jpg")
os.remove("insert.jpg")

def test_insert_m(self):
"""'insert' on memory.
Expand Down

0 comments on commit 71fdb8d

Please sign in to comment.