2018-03-21 06:50:40 -04:00
|
|
|
from .. import convert
|
|
|
|
|
|
|
|
|
2022-03-11 23:04:05 -05:00
|
|
|
def test_to_python():
|
2018-03-21 06:50:40 -04:00
|
|
|
samples = {
|
|
|
|
'A': 0,
|
|
|
|
'B': 1,
|
|
|
|
'Y': 24,
|
|
|
|
'a': 26,
|
|
|
|
'b': 27,
|
|
|
|
'y': 50,
|
|
|
|
'BA': 52,
|
|
|
|
'BAB': 2705,
|
|
|
|
}
|
2022-03-11 23:04:05 -05:00
|
|
|
converter = convert.AbcIdConverter()
|
2018-03-21 06:50:40 -04:00
|
|
|
for abc, id in samples.items():
|
2022-03-11 23:04:05 -05:00
|
|
|
assert converter.to_python(abc) == id
|
2018-03-21 06:50:40 -04:00
|
|
|
|
|
|
|
|
|
|
|
def test_id_to_abc():
|
|
|
|
samples = {
|
|
|
|
1: 'B',
|
|
|
|
24: 'Y',
|
|
|
|
26: 'a',
|
|
|
|
52: 'BA',
|
|
|
|
78: 'Ba',
|
|
|
|
104: 'CA',
|
|
|
|
130: 'Ca',
|
|
|
|
}
|
2022-03-11 23:04:05 -05:00
|
|
|
converter = convert.AbcIdConverter()
|
2018-03-21 06:50:40 -04:00
|
|
|
for id, abc in samples.items():
|
2022-03-11 23:04:05 -05:00
|
|
|
assert converter.to_url(id) == abc
|