2014-04-28 12:29:41 +03:00
|
|
|
"""Test data"""
|
|
|
|
from os import path
|
2014-04-26 19:41:28 +03:00
|
|
|
import codecs
|
2014-04-24 16:17:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
def patharg(path):
|
2014-04-27 00:04:45 +03:00
|
|
|
"""
|
|
|
|
Back slashes need to be escaped in ITEM args,
|
|
|
|
even in Windows paths.
|
|
|
|
|
|
|
|
"""
|
2014-04-24 16:17:04 +03:00
|
|
|
return path.replace('\\', '\\\\\\')
|
|
|
|
|
|
|
|
|
2016-02-29 07:56:21 +02:00
|
|
|
FIXTURES_ROOT = path.join(path.abspath(path.dirname(__file__)))
|
2014-04-28 12:29:41 +03:00
|
|
|
FILE_PATH = path.join(FIXTURES_ROOT, 'test.txt')
|
|
|
|
JSON_FILE_PATH = path.join(FIXTURES_ROOT, 'test.json')
|
|
|
|
BIN_FILE_PATH = path.join(FIXTURES_ROOT, 'test.bin')
|
2014-04-27 00:04:45 +03:00
|
|
|
|
2014-04-24 16:17:04 +03:00
|
|
|
|
|
|
|
FILE_PATH_ARG = patharg(FILE_PATH)
|
|
|
|
BIN_FILE_PATH_ARG = patharg(BIN_FILE_PATH)
|
|
|
|
JSON_FILE_PATH_ARG = patharg(JSON_FILE_PATH)
|
|
|
|
|
2014-04-26 19:41:28 +03:00
|
|
|
|
|
|
|
with codecs.open(FILE_PATH, encoding='utf8') as f:
|
2014-04-24 16:17:04 +03:00
|
|
|
# Strip because we don't want new lines in the data so that we can
|
|
|
|
# easily count occurrences also when embedded in JSON (where the new
|
|
|
|
# line would be escaped).
|
|
|
|
FILE_CONTENT = f.read().strip()
|
2014-04-26 19:41:28 +03:00
|
|
|
|
|
|
|
|
|
|
|
with codecs.open(JSON_FILE_PATH, encoding='utf8') as f:
|
|
|
|
JSON_FILE_CONTENT = f.read()
|
|
|
|
|
|
|
|
|
2014-04-24 16:17:04 +03:00
|
|
|
with open(BIN_FILE_PATH, 'rb') as f:
|
|
|
|
BIN_FILE_CONTENT = f.read()
|
2014-04-26 20:47:14 +03:00
|
|
|
|
|
|
|
UNICODE = FILE_CONTENT
|