Пример #1
0
def test_file_date_with_zeitraum(tmp_file):
    tmp_file.write_text(
        _format(
            '''
            "Kreditkarte:";"{card_number} Kreditkarte";

            "Zeitraum:";"seit der letzten Abrechnung";
            "Saldo:";"5000.01 EUR";
            "Datum:";"30.01.2018";

            {header};
            "Ja";"15.01.2018";"15.01.2018";"REWE Filiale Muenchen";"-10,80";"";
            ''',  # NOQA
            dict(card_number=CARD_NUMBER, header=HEADER),
        ))

    importer = CreditImporter(CARD_NUMBER,
                              'Assets:DKB:Credit',
                              file_encoding='utf-8')

    assert not importer._date_from
    assert not importer._date_to
    assert not importer._balance_amount

    with tmp_file.open() as fd:
        assert importer.file_date(fd) == datetime.date(2018, 1, 30)
Пример #2
0
def test_file_date_is_set_correctly(tmp_file):
    tmp_file.write_text(
        _format(
            '''
            "Kreditkarte:";"{card_number} Kreditkarte";

            "Von:";"01.01.2016";
            "Bis:";"31.01.2016";
            "Saldo:";"5000.01 EUR";
            "Datum:";"30.01.2018";

            {header};
            "Ja";"15.01.2018";"15.01.2018";"REWE Filiale Muenchen";"-10,80";"";
            ''',  # NOQA
            dict(card_number=CARD_NUMBER, header=HEADER),
        ))

    importer = CreditImporter(CARD_NUMBER,
                              'Assets:DKB:Credit',
                              file_encoding='utf-8')

    with tmp_file.open() as fd:
        assert importer.file_date(fd) == datetime.date(2016, 1, 31)