tests: AddEntityHook test for f2c869d
.
This commit is contained in:
parent
7bdd98075f
commit
fdcc214f9f
1 changed files with 19 additions and 17 deletions
|
@ -11,26 +11,28 @@ def test_load_all():
|
|||
all_hooks = list(hooks.load_all())
|
||||
assert add_entity.AddEntityHook in all_hooks
|
||||
|
||||
@pytest.mark.parametrize('payee,expected', [
|
||||
('Alex Smith', 'Smith-Alex'),
|
||||
('Dakota D. Doe', 'Doe-Dakota-D'),
|
||||
('Björk', 'Bjork'),
|
||||
('Fran Doe-Smith', 'Doe-Smith-Fran'),
|
||||
('Alex(Nickname) Smith', 'Smith-Alex'),
|
||||
('稲荷', '稲荷'),
|
||||
('稲(Jan)荷', '稲荷'),
|
||||
('Pøweł', 'Powel'),
|
||||
('Elyse Jan Smith', 'Smith-Elyse-Jan'),
|
||||
('Jan van Smith', 'van-Smith-Jan'),
|
||||
('Francis da Silva', 'da-Silva-Francis'),
|
||||
('A van der B', 'van-der-B-A'),
|
||||
('A de B de la C', 'de-la-C-A-de-B'),
|
||||
@pytest.mark.parametrize('in_key,payee,out_key,expected', [
|
||||
('payee', 'Alex Smith', 'entity', 'Smith-Alex'),
|
||||
('payee', 'Dakota D. Doe', 'entity', 'Doe-Dakota-D'),
|
||||
('payee', 'Björk', 'entity', 'Bjork'),
|
||||
('payee', 'Fran Doe-Smith', 'entity', 'Doe-Smith-Fran'),
|
||||
('payee', 'Alex(Nickname) Smith', 'entity', 'Smith-Alex'),
|
||||
('payee', '稲荷', 'entity', '稲荷'),
|
||||
('payee', '稲(Jan)荷', 'entity', '稲荷'),
|
||||
('payee', 'Pøweł', 'entity', 'Powel'),
|
||||
('payee', 'Elyse Jan Smith', 'entity', 'Smith-Elyse-Jan'),
|
||||
('payee', 'Jan van Smith', 'entity', 'van-Smith-Jan'),
|
||||
('payee', 'Francis da Silva', 'entity', 'da-Silva-Francis'),
|
||||
('payee', 'A van der B', 'entity', 'van-der-B-A'),
|
||||
('payee', 'A de B de la C', 'entity', 'de-la-C-A-de-B'),
|
||||
('corporation', 'Company A', 'corp_entity', 'Company-A'),
|
||||
('corporation', 'Company A 99', 'corp_entity', 'Company-A-99'),
|
||||
])
|
||||
def test_add_entity(payee, expected):
|
||||
data = {'payee': payee}
|
||||
def test_add_entity(in_key, payee, out_key, expected):
|
||||
data = {in_key: payee}
|
||||
hook = add_entity.AddEntityHook(argparse.Namespace())
|
||||
hook.run(data)
|
||||
assert data['entity'] == expected
|
||||
assert data[out_key] == expected
|
||||
|
||||
|
||||
class DateRangeConfig:
|
||||
|
|
Loading…
Reference in a new issue