Skip to content

Commit

Permalink
[FIX] lint
Browse files Browse the repository at this point in the history
  • Loading branch information
i-vyshnevska committed Feb 17, 2021
1 parent 1cbbfac commit 9806df5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion l10n_ch_base_bank/models/partner_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _get_ch_bank_from_iban(self):

@api.onchange("acc_number", "acc_type")
def _onchange_acc_number_set_swiss_bank(self):
""" Deduce information from IBAN
"""Deduce information from IBAN
Bank is defined as:
- Found bank by clearing when using iban
Expand Down
40 changes: 28 additions & 12 deletions l10n_ch_base_bank/tests/test_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ def setUpClass(cls):
)

def new_form(self):
form = Form(self.env["res.partner.bank"], view="l10n_ch.isr_partner_bank_form",)
form = Form(
self.env["res.partner.bank"],
view="l10n_ch.isr_partner_bank_form",
)
form.partner_id = self.partner
return form

def new_empty_form(self):
# in some cases we need form without partner
form = Form(self.env["res.partner.bank"], view="l10n_ch.isr_partner_bank_form",)
form = Form(
self.env["res.partner.bank"],
view="l10n_ch.isr_partner_bank_form",
)
return form

def test_bank_iban(self):
Expand Down Expand Up @@ -93,7 +99,8 @@ def test_bank_postal(self):

self.assertEqual(account.bank_id, self.bank)
self.assertEqual(
account.acc_number, "ISR {} Azure Interior".format(CH_SUBSCRIPTION),
account.acc_number,
"ISR {} Azure Interior".format(CH_SUBSCRIPTION),
)
self.assertEqual(account.l10n_ch_postal, CH_SUBSCRIPTION)
self.assertEqual(account.acc_type, "bank")
Expand All @@ -106,7 +113,8 @@ def test_postal_set_bank_post(self):
self.assertFalse(account.bank_id)
# if acc_number given by user don't update it
self.assertEqual(
account.acc_number, CH_POSTAL,
account.acc_number,
CH_POSTAL,
)
self.assertEqual(account.l10n_ch_postal, CH_POSTAL)
self.assertEqual(account.acc_type, "postal")
Expand Down Expand Up @@ -248,7 +256,8 @@ def test_create_bank_default_acc_number(self):

# account number set based on ccp
self.assertEqual(
account.acc_number, "ISR {} Azure Interior".format(CH_SUBSCRIPTION),
account.acc_number,
"ISR {} Azure Interior".format(CH_SUBSCRIPTION),
)
self.assertEqual(account.l10n_ch_postal, CH_SUBSCRIPTION)

Expand All @@ -265,14 +274,16 @@ def test_onchange_post_bank_acc_number(self):
# if it's ISR subscription, copy ISR + value in acc_number
bank_acc.l10n_ch_postal = CH_SUBSCRIPTION
self.assertEqual(
bank_acc.acc_number, "ISR {}".format(CH_SUBSCRIPTION),
bank_acc.acc_number,
"ISR {}".format(CH_SUBSCRIPTION),
)

# if it's ISR subscription, copy ISR + value in acc_number
# In this case we have the partner set
bank_acc.partner_id = self.partner
self.assertEqual(
bank_acc.acc_number, "ISR {} Azure Interior".format(CH_SUBSCRIPTION),
bank_acc.acc_number,
"ISR {} Azure Interior".format(CH_SUBSCRIPTION),
)
self.assertEqual(bank_acc.l10n_ch_postal, CH_SUBSCRIPTION)

Expand All @@ -289,7 +300,8 @@ def test_onchange_post_bank_isr_in_acc_number(self):

self.assertEqual(bank_acc.l10n_ch_postal, CH_SUBSCRIPTION)
self.assertEqual(
bank_acc.acc_number, "ISR {} Azure Interior".format(CH_SUBSCRIPTION),
bank_acc.acc_number,
"ISR {} Azure Interior".format(CH_SUBSCRIPTION),
)

def test_name_search(self):
Expand All @@ -316,7 +328,8 @@ def test_multiple_postal_number_for_same_partner(self):

self.assertFalse(account2.bank_id)
self.assertEqual(
account2.acc_number, "ISR {} Azure Interior #1".format(CH_SUBSCRIPTION),
account2.acc_number,
"ISR {} Azure Interior #1".format(CH_SUBSCRIPTION),
)
self.assertEqual(account2.acc_type, "bank")

Expand All @@ -327,7 +340,8 @@ def test_multiple_postal_number_for_same_partner(self):
# no bank matches
self.assertFalse(account3.bank_id)
self.assertEqual(
account3.acc_number, "ISR {} Azure Interior #2".format(CH_SUBSCRIPTION),
account3.acc_number,
"ISR {} Azure Interior #2".format(CH_SUBSCRIPTION),
)
self.assertEqual(account3.acc_type, "bank")
account3.unlink()
Expand All @@ -339,7 +353,8 @@ def test_multiple_postal_number_for_same_partner(self):
account4 = bank_acc_4.save()

self.assertEqual(
account4.acc_number, "ISR {} Azure Interior #2".format(CH_SUBSCRIPTION),
account4.acc_number,
"ISR {} Azure Interior #2".format(CH_SUBSCRIPTION),
)

def test_acc_name_generation(self):
Expand All @@ -365,7 +380,8 @@ def test_acc_name_generation(self):
account.l10n_ch_postal = CH_SUBSCRIPTION
account._update_acc_number()
self.assertEqual(
account.acc_number, "ISR {} Azure Interior".format(CH_SUBSCRIPTION),
account.acc_number,
"ISR {} Azure Interior".format(CH_SUBSCRIPTION),
)
# remove partner name
account.partner_id = ""
Expand Down

0 comments on commit 9806df5

Please sign in to comment.