HPI/my/core/tests/auto_stats.py
karlicoss a60d69fb30 core/stats: get rid of duplicated keys for 'auto stats'
previously:
```
{'iter_data': {'iter_data': {'count': 9, 'last': datetime.datetime(2020, 1, 3, 1, 1, 1)}}}
```

after
```
{'iter_data': {'count': 9, 'last': datetime.datetime(2020, 1, 3, 1, 1, 1)}}
```
2023-10-22 00:47:36 +01:00

30 lines
611 B
Python

"""
Helper 'module' for test_guess_stats
"""
from dataclasses import dataclass
from datetime import datetime, timedelta
from pathlib import Path
from typing import Iterable, Sequence
@dataclass
class Item:
id: str
dt: datetime
source: Path
def inputs() -> Sequence[Path]:
return [
Path('file1.json'),
Path('file2.json'),
Path('file3.json'),
]
def iter_data() -> Iterable[Item]:
dt = datetime.fromisoformat('2020-01-01 01:01:01')
for path in inputs():
for i in range(3):
yield Item(id=str(i), dt=dt + timedelta(days=i), source=path)