This repository has been archived on 2024-07-30. You can view files and clone it, but cannot push or open issues or pull requests.
python-aternos/tests/files.py
DarkCat09 e91824f478 Some improvements in unittests
- Removed credentials, they must be placed in tests/samples/login_pswd.txt in format "user(newline)md5"
- Simplified working with files (reading samples)
- Added some new token functions, removed some old
2022-10-19 18:40:09 +04:00

20 lines
420 B
Python

from pathlib import Path
from typing import List
abs_dir = Path(__file__).absolute().parent
samples = abs_dir / 'samples'
def read_sample(name: str) -> List[str]:
path = samples / name
if not path.exists():
return []
with path.open('rt', encoding='utf-8') as file:
return file \
.read() \
.strip() \
.replace('\r\n', '\n') \
.split('\n')