Changeset - 7c11ae408cc8
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-05-17 17:32:32
brettcsmith@brettcsmith.org
tests: Prep historical tests for parametrizing on output format.
1 file changed with 36 insertions and 22 deletions:
0 comments (0 inline, 0 general)
tests/test_historical.py
Show inline comments
...
 
@@ -40,2 +40,5 @@ class FakeConfig:
 
output = pytest.fixture(lambda: io.StringIO())
 
parametrize_format = pytest.mark.parametrize('output_format', [
 
    oxrhist.Formats.LEDGER,
 
])
 

	
...
 
@@ -59,3 +62,3 @@ def build_config(
 
        from_date=None,
 
        ledger=False,
 
        output_format=oxrhist.Formats.RAW,
 
        signed_currencies=None,
...
 
@@ -71,3 +74,3 @@ def build_config(
 
        'from_date': from_date,
 
        'output_format': oxrhist.Formats['LEDGER' if ledger else 'RAW'],
 
        'output_format': output_format,
 
        'signed_currencies': [base] if signed_currencies is None else signed_currencies,
...
 
@@ -128,5 +131,6 @@ def test_back_conversion(single_responder, output, any_date):
 

	
 
def test_ledger_rate(single_responder, output, any_date):
 
@parametrize_format
 
def test_ledger_rate(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='ANG', ledger=True)
 
                          from_currency='ANG', output_format=output_format)
 
    lines = lines_from_run(config, output)
...
 
@@ -136,5 +140,6 @@ def test_ledger_rate(single_responder, output, any_date):
 

	
 
def test_ledger_conversion(single_responder, output, any_date):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='ALL', amount=300, ledger=True)
 
@parametrize_format
 
def test_ledger_conversion(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date, from_currency='ALL',
 
                          amount=300, output_format=output_format)
 
    lines = lines_from_run(config, output)
...
 
@@ -144,5 +149,6 @@ def test_ledger_conversion(single_responder, output, any_date):
 

	
 
def test_signed_currencies(single_responder, output, any_date):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='AED', ledger=True, signed_currencies=['EUR'])
 
@parametrize_format
 
def test_signed_currencies(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date, from_currency='AED',
 
                          output_format=output_format, signed_currencies=['EUR'])
 
    lines = lines_from_run(config, output)
...
 
@@ -152,6 +158,7 @@ def test_signed_currencies(single_responder, output, any_date):
 

	
 
def test_denomination(single_responder, output, any_date):
 
@parametrize_format
 
def test_denomination(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='ANG', to_currency='AED', amount=10,
 
                          ledger=True, denomination='USD')
 
                          output_format=output_format, denomination='USD')
 
    lines = lines_from_run(config, output)
...
 
@@ -161,6 +168,7 @@ def test_denomination(single_responder, output, any_date):
 

	
 
def test_redundant_denomination(single_responder, output, any_date):
 
@parametrize_format
 
def test_redundant_denomination(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='ANG', to_currency='USD', amount=10,
 
                          ledger=True, denomination='USD')
 
                          output_format=output_format, denomination='USD')
 
    lines = lines_from_run(config, output)
...
 
@@ -170,6 +178,7 @@ def test_redundant_denomination(single_responder, output, any_date):
 

	
 
def test_from_denomination(single_responder, output, any_date):
 
@parametrize_format
 
def test_from_denomination(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='USD', to_currency='ALL', amount=10,
 
                          ledger=True, denomination='USD')
 
                          output_format=output_format, denomination='USD')
 
    lines = lines_from_run(config, output)
...
 
@@ -179,6 +188,7 @@ def test_from_denomination(single_responder, output, any_date):
 

	
 
def test_rate_precision_added_as_needed(single_responder, output, any_date):
 
@parametrize_format
 
def test_rate_precision_added_as_needed(single_responder, output, any_date, output_format):
 
    config = build_config(single_responder, any_date,
 
                          from_currency='RUB', to_currency='USD', amount=63805,
 
                          ledger=True, denomination='USD')
 
                          output_format=output_format, denomination='USD')
 
    lines = lines_from_run(config, output)
...
 
@@ -192,6 +202,8 @@ def test_rate_precision_added_as_needed(single_responder, output, any_date):
 

	
 
def test_from_date_rates(alternate_responder, output, any_date):
 
@parametrize_format
 
def test_from_date_rates(alternate_responder, output, any_date, output_format):
 
    config = build_config(alternate_responder, any_date,
 
                          from_currency='ANG', to_currency='AED',
 
                          from_date=any_date, ledger=True, denomination='USD')
 
                          from_date=any_date, output_format=output_format,
 
                          denomination='USD')
 
    lines = lines_from_run(config, output)
...
 
@@ -201,6 +213,8 @@ def test_from_date_rates(alternate_responder, output, any_date):
 

	
 
def test_from_date_conversion(alternate_responder, output, any_date):
 
@parametrize_format
 
def test_from_date_conversion(alternate_responder, output, any_date, output_format):
 
    config = build_config(alternate_responder, any_date,
 
                          from_currency='ANG', to_currency='AED', amount=10,
 
                          from_date=any_date, ledger=True, denomination='USD')
 
                          from_date=any_date, output_format=output_format,
 
                          denomination='USD')
 
    lines = lines_from_run(config, output)
0 comments (0 inline, 0 general)