Buckets:
| from modules import investment, valuation, personal, corporate | |
| def test_npv_irr(): | |
| print("Testing Investment Metrics...") | |
| cash_flows = [-100, 20, 30, 50, 60] | |
| rate = 0.1 | |
| npv = investment.calculate_npv(rate, cash_flows) | |
| irr = investment.calculate_irr(cash_flows) | |
| print(f"NPV: {npv:.2f}, IRR: {irr:.4f}") | |
| assert npv > 0 | |
| assert irr > 0.1 | |
| print("PASSED") | |
| def test_valuation(): | |
| print("Testing Valuation...") | |
| res = valuation.dcf_valuation(100, 0.05, 0.02, 0.1, 5) | |
| print(f"Enterprise Value: {res['enterprise_value']:.2f}") | |
| assert res["enterprise_value"] > 0 | |
| print("PASSED") | |
| def test_personal(): | |
| print("Testing Personal Finance...") | |
| mortgage = personal.mortgage_calculator(300000, 0.04, 30) | |
| print(f"Monthly Payment: {mortgage['monthly_payment']:.2f}") | |
| assert 1400 < mortgage["monthly_payment"] < 1500 | |
| savings = personal.savings_projection(1000, 500, 0.07, 10) | |
| print(f"Future Value: {savings['future_value']:.2f}") | |
| assert savings["future_value"] > 60000 | |
| print("PASSED") | |
| def test_corporate(): | |
| print("Testing Corporate Finance...") | |
| wacc = corporate.calculate_wacc(1000000, 500000, 0.1, 0.05, 0.21) | |
| print(f"WACC: {wacc:.4f}") | |
| assert 0.07 < wacc < 0.09 | |
| print("PASSED") | |
| if __name__ == "__main__": | |
| test_npv_irr() | |
| test_valuation() | |
| test_personal() | |
| test_corporate() | |
| print("\nAll Finance MCP tests passed!") | |
Xet Storage Details
- Size:
- 1.43 kB
- Xet hash:
- 8756c87d42547d9db75c284b38d54e8faa3676dda71eb7f5b875dad11f798124
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.