Changeset - 72f58d80d735
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-06-15 18:09:42
brettcsmith@brettcsmith.org
reports: BaseODS.currency_cell() sets default style.

It'll be rare we don't want this.
2 files changed with 15 insertions and 0 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/core.py
Show inline comments
...
 
@@ -924,2 +924,4 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
 
    def currency_cell(self, amount: data.Amount, **attrs: Any) -> odf.table.TableCell:
 
        if 'stylename' not in attrs:
 
            attrs['stylename'] = self.currency_style(amount.currency)
 
        number, currency = amount
tests/test_reports_spreadsheet.py
Show inline comments
...
 
@@ -472,2 +472,15 @@ def test_ods_writer_currency_cell(ods_writer, cell_source, style_name):
 

	
 
@pytest.mark.parametrize('currency', [
 
    'EUR',
 
    'CHF',
 
    'GBP',
 
])
 
def test_ods_writer_currency_cell_default_style(ods_writer, currency):
 
    amount = testutil.Amount(1000, currency)
 
    expected_stylename = ods_writer.currency_style(currency).getAttribute('name')
 
    cell = ods_writer.currency_cell(amount)
 
    assert cell.getAttribute('valuetype') == 'currency'
 
    assert cell.getAttribute('value') == '1000'
 
    assert cell.getAttribute('stylename') == expected_stylename
 

	
 
@pytest.mark.parametrize('date,style_name', testutil.combine_values(
0 comments (0 inline, 0 general)