<commit_before>from django.test import TestCase

from mock import patch

from ..models import MangoPayBankAccount

from .factories import (MangoPayIBANBankAccountFactory,
                        MangoPayOTHERBankAccountFactory)
from .client import MockMangoPayApi

from ..constants import (BA_BIC_IBAN,
                         BA_OTHER)


class MangoPayBankAccountTests(TestCase):

    def setUp(self):
        self.bank_account_iban = MangoPayIBANBankAccountFactory()
        self.bank_account_other = MangoPayOTHERBankAccountFactory()
        self.bank_account_us = MangoPayOTHERBankAccountFactory(account_type="US")

    @patch("mangopay.models.get_mangopay_api_client")
    def test_create_iban_bank_account(self, mock_client):
        id_ = 33322
        mock_client.return_value = MockMangoPayApi(bank_account_id=id_)
        self.assertIsNone(self.bank_account_iban.mangopay_id)
        self.bank_account_iban.create()
        MangoPayBankAccount.objects.get(id=self.bank_account_iban.id,
                                        mangopay_id=id_)
        self.assertEqual(self.bank_account_iban.account_type,
                         BA_BIC_IBAN)
        self.assertTrue(self.bank_account_iban.iban is not "")
        self.assertTrue(self.bank_account_iban.account_number is None)

    @patch("mangopay.models.get_mangopay_api_client")
    def test_create_other_bank_account(self, mock_client):
        id_ = 22333
        mock_client.return_value = MockMangoPayApi(bank_account_id=id_)
        self.assertIsNone(self.bank_account_other.mangopay_id)
        self.bank_account_other.create()
        MangoPayBankAccount.objects.get(id=self.bank_account_other.id,
                                        mangopay_id=id_)
        self.assertEqual(self.bank_account_other.account_type,
                         BA_OTHER)
        self.assertTrue(self.bank_account_other.iban is None)
        self.assertTrue(self.bank_account_other.account_number is not None)<commit_msg>Minor adjustments to tests<commit_after>from django.test import TestCase

from mock import patch

from ..models import MangoPayBankAccount

from .factories import (MangoPayIBANBankAccountFactory,
                        MangoPayOTHERBankAccountFactory)
from .client import MockMangoPayApi

from ..constants import (BA_BIC_IBAN,
                         BA_OTHER)


class MangoPayBankAccountTests(TestCase):

    def setUp(self):
        self.bank_account_iban = MangoPayIBANBankAccountFactory()
        self.bank_account_other = MangoPayOTHERBankAccountFactory()
        self.bank_account_us = MangoPayOTHERBankAccountFactory(account_type="US")

    @patch("mangopay.models.get_mangopay_api_client")
    def test_create_iban_bank_account(self, mock_client):
        id_ = 33322
        mock_client.return_value = MockMangoPayApi(bank_account_id=id_)
        self.assertIsNone(self.bank_account_iban.mangopay_id)
        self.bank_account_iban.create()
        MangoPayBankAccount.objects.get(id=self.bank_account_iban.id,
                                        mangopay_id=id_)
        self.assertEqual(self.bank_account_iban.account_type,
                         BA_BIC_IBAN)

        self.assertIsNone(self.bank_account_iban.account_number)
        self.assertIsNotNone(self.bank_account_iban.iban)

    @patch("mangopay.models.get_mangopay_api_client")
    def test_create_other_bank_account(self, mock_client):
        id_ = 22333
        mock_client.return_value = MockMangoPayApi(bank_account_id=id_)
        self.assertIsNone(self.bank_account_other.mangopay_id)
        self.bank_account_other.create()
        MangoPayBankAccount.objects.get(id=self.bank_account_other.id,
                                        mangopay_id=id_)
        self.assertEqual(self.bank_account_other.account_type,
                         BA_OTHER)

        self.assertIsNone(self.bank_account_other.iban)
        self.assertIsNotNone(self.bank_account_other.account_number)
{'fraction_non_alphanumeric': 0.07112014224028448, 'fraction_numerical': 0.00508001016002032, 'mean_word_length': 2.98582995951417, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '337806', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1174, 'n_words': 147}