Update tests to match new API.

This commit is contained in:
joo committed 2016-06-17 22:54:21 +01:00
1 parent c8b3e7a809
commit 3ff7662684
7 files changed
+85 -62

No files matched your search

-1
View File
@@ -1,7 +1,6 @@
from __future__ import print_function
from collections import deque
from collections import namedtuple
from threading import Lock
from zlib import decompress
from itertools import *
+4
View File
@@ -401,6 +401,10 @@ class PlayerListItemPacket(Packet):
self.uuid = UUID.read(file_object)
self._read(file_object)
def _read(self, file_object):
raise NotImplementedError(
'This abstract method must be overridden in a subclass.')
@classmethod
def type_from_id(cls, action_id):
subcls = {
+4 -1
View File
@@ -84,7 +84,10 @@ class VarInt(Type):
def read(file_object):
number = 0
for i in range(5):
byte = ord(file_object.read(1))
byte = file_object.read(1)
if len(byte) < 1:
raise RuntimeError("Unexpected end of message.")
byte = ord(byte)
number |= (byte & 0x7F) << 7 * i
if not byte & 0x80:
break