lemoncurry/lemonshort/tests/convert.py

32 lines
621 B
Python

from .. import convert
def test_to_python():
samples = {
'A': 0,
'B': 1,
'Y': 24,
'a': 26,
'b': 27,
'y': 50,
'BA': 52,
'BAB': 2705,
}
converter = convert.AbcIdConverter()
for abc, id in samples.items():
assert converter.to_python(abc) == id
def test_id_to_abc():
samples = {
1: 'B',
24: 'Y',
26: 'a',
52: 'BA',
78: 'Ba',
104: 'CA',
130: 'Ca',
}
converter = convert.AbcIdConverter()
for id, abc in samples.items():
assert converter.to_url(id) == abc