fix pathod test on Windows

This commit is contained in:
Maximilian Hils 2016-06-06 11:37:49 -07:00
parent 210c376901
commit 1214085f67
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import random
import mmap import mmap
import six import six
import sys
DATATYPES = dict( DATATYPES = dict(
ascii_letters=string.ascii_letters.encode(), ascii_letters=string.ascii_letters.encode(),
@ -68,7 +69,7 @@ class RandomGenerator(object):
def __getitem__(self, x): def __getitem__(self, x):
chars = DATATYPES[self.dtype] chars = DATATYPES[self.dtype]
if isinstance(x, slice): if isinstance(x, slice):
return b"".join(rand_byte(chars) for _ in range(*x.indices(self.length))) return b"".join(rand_byte(chars) for _ in range(*x.indices(min(self.length, sys.maxsize))))
return rand_byte(chars) return rand_byte(chars)
def __repr__(self): def __repr__(self):