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)}} ```
This commit is contained in:
parent
c5fe2e9412
commit
bf6f57c7db
3 changed files with 63 additions and 7 deletions
30
my/core/tests/auto_stats.py
Normal file
30
my/core/tests/auto_stats.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
"""
|
||||
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)
|
Loading…
Add table
Add a link
Reference in a new issue