Skip to content

Commit

Permalink
Python3: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
macfreek committed Mar 13, 2012
1 parent 8d050c0 commit 0ba7890
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions nbt/nbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

try:
unicode
basestring
except NameError:
unicode = str # compatibility for Python 3
basestring = str # compatibility for Python 3


TAG_END = 0
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def testEmptyFiles(self):
Opening an empty file causes an uncaught exception.
https://github.com/twoolie/NBT/issues/issue/4
"""
temp = BytesIO("")
temp = BytesIO(b"")
temp.seek(0)
self.assertRaises(MalformedFileError, NBTFile, buffer=temp)

Expand Down Expand Up @@ -102,7 +102,7 @@ def tearDown(self):
class EmptyStringTest(unittest.TestCase):

def setUp(self):
self.golden_value = "\x0A\0\x04Test\x08\0\x0Cempty string\0\0\0"
self.golden_value = b"\x0A\0\x04Test\x08\0\x0Cempty string\0\0\0"
self.nbtfile = NBTFile(buffer=BytesIO(self.golden_value))

def testReadEmptyString(self):
Expand Down

0 comments on commit 0ba7890

Please sign in to comment.