fix pathod test on Windows
This commit is contained in:
parent
210c376901
commit
1214085f67
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue