Test formatting of list of sources.
This commit is contained in:
parent
c13e329208
commit
1124b6f86c
1 changed files with 16 additions and 0 deletions
16
tests/pricehist/test_sources.py
Normal file
16
tests/pricehist/test_sources.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import re
|
||||
|
||||
from pricehist import sources
|
||||
|
||||
|
||||
def test_formatted_includes_ecb():
|
||||
lines = sources.formatted().splitlines()
|
||||
assert any(re.match(r"ecb +European Central Bank", line) for line in lines)
|
||||
|
||||
|
||||
def test_formatted_names_aligned():
|
||||
lines = sources.formatted().splitlines()
|
||||
offsets = [len(re.match(r"(\w+ +)[^ ]", line)[1]) for line in lines]
|
||||
first = offsets[0]
|
||||
assert first > 1
|
||||
assert all(offset == first for offset in offsets)
|
Loading…
Add table
Reference in a new issue