def test_determineRoyaltyPrice(self): m = DataStructure() m.WellHeadPrice = 221.123456 m.TransRate = 2.123455 m.ProcessingRate = 0.123455 pr = ProcessRoyalties() self.assertAlmostEqual(pr.determine_royalty_price('ActSales', m), 223.370366) m.WellHeadPrice = 225 m.TransRate = 3 m.ProcessingRate = 1 self.assertAlmostEqual(pr.determine_royalty_price('ActSales', m), 229)
def test_calcSupplementaryRoyaltiesIOGR1995(self): reference_price = { 'Pigeon Lake Indian': 24.04, 'Reserve no.138A': 25.37, 'Sawridge Indian': 25.13, 'Stony Plain Indian': 24.64 } pr = ProcessRoyalties() calc = DataStructure() self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 3.5, 228, 80, 60, reference_price['Pigeon Lake Indian']), 2039.6) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 5, 200, 90, 40, reference_price['Reserve no.138A']), 4365.75) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 4, 221.123456, 100, 50, reference_price['Sawridge Indian']), 4899.84) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( .2, 180, 80, 35, reference_price['Stony Plain Indian']), 3495.6) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 6, 228, 80, 60, reference_price['Pigeon Lake Indian']), 2996.5) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 5.5, 200, 90, 40, reference_price['Reserve no.138A']), 6391.38) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 8, 221.123456, 100, 50, reference_price['Sawridge Indian']), 7192.5) self.assertEqual( pr.calc_supplementary_royalties_iogr1995( 15, 180, 80, 35, reference_price['Stony Plain Indian']), 5101.88)
def test_calcSaskOilProvCrownRoyaltyRate(self): econStringData = \ """ CharMonth,ProdMonth,HOP,SOP,NOP,H4T_C,H4T_D,H4T_K,H4T_X,H3T_K,H3T_X,HNEW_K,HNEW_X,SW4T_C,SW4T_D,SW4T_K,SW4T_X,SW3T_K,SW3T_X,SWNEW_K,SWNEW_X,O4T_C,O4T_D,O4T_K,O4T_X,O3T_K,O3T_X,ONEW_K,ONEW_X,OOLD_K,OOLD_X Sept.,201509,162,210,276,0.0841,2.1,20.81,1561,20.46,472,26.48,611,0.1045,2.61,25.85,1939,31.57,729,38.54,890,0.1209,3.02,29.91,2243,36.08,833,40.79,941,52.61,1214 """ # All this work so we don't need to read from the database. It's a way better test. econOilData = DataStructure() th = TestHelper() royaltyCalc = DataStructure() th.load_object_csv_style(econOilData, econStringData) pr = ProcessRoyalties() self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Heavy', 24, 0), 0) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Heavy', 100, 0), 6.31) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Southwest', 100, 0), 7.84) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Other', 130, 0), 12.697) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Heavy', 140, 0), 9.66) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Southwest', 136.3, 0), 11.624028) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Other', 150, 0), 14.956667) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Fourth Tier Oil', 'Other', 0, 0), 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Fourth Tier Oil', 'BadString', 120, 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Fourth Tier Oil', 'BadString', 140, 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Bad String', 'Heavy', 120, 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Bad String', 'Southwest', 120, 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Bad String', 'Other', 120, 0) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Third Tier Oil', 'Heavy', 100, 0.75), 14.99) self.assertAlmostEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'New Oil', 'Heavy', 100, 0.75), 19.620000) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'New Oil', 'Heavy', 0, 0), 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Third Tier Oil', 'Bad String', 120, 0) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Third Tier Oil', 'Southwest', 120, 0), 25.495000) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'New Oil', 'Southwest', 130, 0.75), 30.943846) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'New Oil', 'Southwest', 0, 0), 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'New Oil', 'Bad String', 120, 0) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Third Tier Oil', 'Other', 120, 2.25), 26.888333) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'New Oil', 'Other', 110, 0), 32.235455) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Old Oil', 'Other', 100, 0.75), 39.720000) self.assertEqual( pr.calc_sask_oil_prov_crown_royalty_rate(royaltyCalc, econOilData, 'Old Oil', 'Other', 0, 0), 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Old Oil', 'Bad String', 120, 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Old Oil', 'Heavy', 120, 0) self.assertRaises(AppError, pr.calc_sask_oil_prov_crown_royalty_rate, royaltyCalc, econOilData, 'Old Oil', 'Southwest', 120, 0) return
def test_calcSaskOilIOGR1995(self): m = DataStructure() m.WellHeadPrice = 221.123456 m.TransRate = 2.123455 m.ProcessingRate = 0.123455 m.ProdVol = 70 m.ProdMonth = 201501 calc = DataStructure() pr = ProcessRoyalties() #all tests for SaskWellHead pr.calc_sask_oil_iogr1995(datetime(2015, 1, 1), "SaskWellHead", 1.2, 0.25, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 464.36) self.assertEqual(calc.CommencementPeriod, 0) self.assertEqual(calc.IOGR1995RoyaltyVolume, 7) self.assertEqual(calc.RoyaltyPrice, 221.123456) m.ProdVol = 100 pr.calc_sask_oil_iogr1995(datetime(2015, 4, 2), "SaskWellHead", 0.25, 3, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 1990.11) m.ProdVol = 170 pr.calc_sask_oil_iogr1995(datetime(2015, 5, 1), "SaskWellHead", 1, 1, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 5881.88) m.ProdVol = 79.9 pr.calc_sask_oil_iogr1995(datetime(2010, 1, 1), "SaskWellHead", 3, 2, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 10600.66) m.ProdVol = 150 pr.calc_sask_oil_iogr1995(datetime(2009, 7, 3), "SaskWellHead", 2, 4, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 38917.73) m.ProdVol = 500 pr.calc_sask_oil_iogr1995(datetime(2007, 8, 2), "SaskWellHead", 1, 5, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 124271.38) m.ProdVol = 800 pr.calc_sask_oil_iogr1995(datetime(2008, 9, 9), "SaskWellHead", 5, 0.1, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 21117.29)
def test_calcSaskOilIOGR1995(self): m = DataStructure() m.WellHeadPrice = 221.123456 m.TransRate = 2.123455 m.ProcessingRate = 0.123455 m.ProdVol = 70 m.ProdMonth = 201501 calc = DataStructure() pr = ProcessRoyalties() #all tests for SaskWellHead pr.calc_sask_oil_iogr1995(datetime(2015, 1, 1), "SaskWellHead", 1.2, 0.25, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue,464.36) self.assertEqual(calc.CommencementPeriod,0) self.assertEqual(calc.IOGR1995RoyaltyVolume,7) self.assertEqual(calc.RoyaltyPrice,221.123456) m.ProdVol = 100 pr.calc_sask_oil_iogr1995(datetime(2015, 4, 2), "SaskWellHead", 0.25, 3, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue,1990.11) m.ProdVol = 170 pr.calc_sask_oil_iogr1995(datetime(2015, 5, 1), "SaskWellHead", 1, 1, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 5881.88) m.ProdVol = 79.9 pr.calc_sask_oil_iogr1995(datetime(2010, 1, 1), "SaskWellHead", 3, 2, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue,10600.66) m.ProdVol = 150 pr.calc_sask_oil_iogr1995(datetime(2009, 7, 3), "SaskWellHead", 2, 4, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 38917.73) m.ProdVol = 500 pr.calc_sask_oil_iogr1995(datetime(2007, 8, 2), "SaskWellHead", 1, 5, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 124271.38) m.ProdVol = 800 pr.calc_sask_oil_iogr1995(datetime(2008, 9, 9), "SaskWellHead", 5, 0.1, m, calc) self.assertEqual(calc.IOGR1995RoyaltyValue, 21117.29)