diff --git a/golden_tests/TestFinBond.py b/golden_tests/TestFinBond.py index 52dd1b94..e3e80fe1 100644 --- a/golden_tests/TestFinBond.py +++ b/golden_tests/TestFinBond.py @@ -556,9 +556,8 @@ def test_bond_payment_dates(): def test_bond_ror(): - test_case_file = 'test_cases_bond_ror.csv' - df = pd.read_csv('.//data//' + test_case_file, parse_dates=['buy_date', - 'sell_date']) + path = os.path.join(os.path.dirname(__file__), './/data//test_cases_bond_ror.csv') + df = pd.read_csv(path, parse_dates=['buy_date','sell_date']) # A 10-year bond with 1 coupon per year. code: 210215 bond = Bond( diff --git a/golden_tests/TestFinBondZeroCoupon.py b/golden_tests/TestFinBondZeroCoupon.py index b3538d9c..da120e81 100644 --- a/golden_tests/TestFinBondZeroCoupon.py +++ b/golden_tests/TestFinBondZeroCoupon.py @@ -2,7 +2,9 @@ # Copyright (C) 2018, 2019, 2020 Dominic O'Kane ############################################################################### +import os import sys + import pandas as pd sys.path.append("..") @@ -50,8 +52,9 @@ def test_bond_zero(): def test_bond_zero_ror(): - test_case_file = 'test_cases_bond_zero_ror.csv' - df = pd.read_csv('.//data//' + test_case_file, parse_dates=['buy_date', 'sell_date']) + + path = os.path.join(os.path.dirname(__file__), './/data//test_cases_bond_ror.csv') + df = pd.read_csv(path, parse_dates=['buy_date', 'sell_date']) # A 1-year bond with zero coupon per year. code: 092103011 bond = BondZero( issue_dt=Date(23, 7, 2021), diff --git a/golden_tests/TestFinBondZeroCurve.py b/golden_tests/TestFinBondZeroCurve.py index b0907942..6851a255 100644 --- a/golden_tests/TestFinBondZeroCurve.py +++ b/golden_tests/TestFinBondZeroCurve.py @@ -2,19 +2,19 @@ # Copyright (C) 2018, 2019, 2020 Dominic O'Kane ############################################################################### +import os import sys sys.path.append("..") +import datetime as dt + + from FinTestCases import FinTestCases, globalTestCaseMode from financepy.products.bonds.bond import Bond - from financepy.products.bonds.bond_zero_curve import BondZeroCurve - from financepy.utils.date import Date, from_datetime from financepy.utils.day_count import DayCountTypes from financepy.utils.frequency import FrequencyTypes -import datetime as dt -import os test_cases = FinTestCases(__file__, globalTestCaseMode)