features/purchase_committees.feature in purchase-0.1.6 vs features/purchase_committees.feature in purchase-0.1.7

- old
+ new

@@ -3,16 +3,26 @@ Scenario Outline: Cost committee from purchase amount Given a purchase emitter And a characteristic "purchase_amount" of "<amount>" When the "cost" committee is calculated - And the conclusion of the committee should be "<cost>" + Then the conclusion of the committee should be "<cost>" Examples: | amount | cost | | 831.23 | 748.107 | | 11.00 | 9.9 | + Scenario Outline: Cost committee from purchase amount and tax + Given a purchase emitter + And a characteristic "purchase_amount" of "<amount>" + And a characteristic "tax" of "<tax>" + When the "cost" committee is calculated + Then the conclusion of the committee should be "<cost>" + Examples: + | amount | tax | cost | + | 10.00 | 1.00 | 9.00 | + Scenario Outline: Adjusted cost committee from cost and date Given a purchase emitter And a characteristic "cost" of "<cost>" And characteristic "date" of "<date>" When the "adjusted_cost" committee is calculated @@ -31,14 +41,51 @@ Examples: | id | mcc | | 1 | 5111 | | 2 | 5732 | - Scenario Outline: Industry shares committee from merchant category + Scenario Outline: Merchant categories industries committee from merchant category Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" - When the "industry_shares" committee is calculated + When the "merchant_categories_industries" committee is calculated + Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<ratio>" + Examples: + | mcc | naics | ratio | + | 3504 | 72111 | 1 | + | 5111 | 45321 | 1 | + | 5172 | 32411 | 0.8 | + | 5172 | 324121 | 0.05 | + | 5172 | 324122 | 0.05 | + | 5172 | 324191 | 0.05 | + | 5172 | 324199 | 0.05 | + | 5732 | 443112 | 1 | + | 5812 | 72211 | 1 | + | 8225 | 6623 | 0.5 | + + Scenario Outline: Merchant categories industries committee from industry + Given a purchase emitter + And a characteristic "naics_code" of "<naics>" + When the "merchant_categories_industries" committee is calculated + Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<ratio>" + Examples: + | naics | ratio | + | 72111 | 1 | + | 45321 | 1 | + | 32411 | 0.8 | + | 324121 | 0.05 | + | 324122 | 0.05 | + | 324191 | 0.05 | + | 324199 | 0.05 | + | 443112 | 1 | + | 72211 | 1 | + | 6623 | 0.5 | + + Scenario Outline: Industry shares committee from merchant categories industries + Given a purchase emitter + And a characteristic "merchant_category.mcc" of "<mcc>" + When the "merchant_categories_industries" committee is calculated + And the "industry_shares" committee is calculated Then the conclusion of the committee should have a record identified with "naics_code" of "<naics>" and having "ratio" of "<share>" Examples: | mcc | naics | share | | 5111 | 45321 | 1.0 | | 5172 | 32411 | 0.8 | @@ -48,11 +95,12 @@ | 5172 | 324199 | 0.05 | Scenario Outline: Product line shares committee from merchant category Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" - When the "industry_shares" committee is calculated + When the "merchant_categories_industries" committee is calculated + And the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated Then the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>" Examples: | mcc | ps_code | share | | 5111 | 20340 | 0.084 | @@ -63,105 +111,110 @@ | 5111 | 20853 | 0.265 | | 5111 | 20854 | 0.071 | | 5111 | 29938 | 0.011 | | 5111 | 29979 | 0.013 | - Scenario Outline: Sector shares committee from merchant category + Scenario Outline: Product line shares committee from industry + Given a purchase emitter + And a characteristic "naics_code" of "<naics>" + When the "product_line_shares" committee is calculated + Then the conclusion of the committee should have a record identified with "ps_code" of "<ps_code>" and having "ratio" of "<share>" + Examples: + | naics | ps_code | share | + | 45321 | 20340 | 0.084 | + | 45321 | 20370 | 0.283 | + | 45321 | 20440 | 0.006 | + | 45321 | 20851 | 0.122 | + | 45321 | 20852 | 0.145 | + | 45321 | 20853 | 0.265 | + | 45321 | 20854 | 0.071 | + | 45321 | 29938 | 0.011 | + | 45321 | 29979 | 0.013 | + | 443112 | 20375 | 0.5 | + | 443112 | 20321 | 0.25 | + | 443112 | 20865 | 0.2 | + + Scenario Outline: Sector shares committee from industry and product line shares Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" - When the "industry_shares" committee is calculated + When the "merchant_categories_industries" committee is calculated + And the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated And the "sector_shares" committee is calculated - Then the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "emission_factor" of "<emission_factor>" - And the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "share" of "<share>" + Then the conclusion of the committee should be a vector with value "<share>" and position for key "<io_code>" Examples: - | mcc | io_code | emission_factor | share | - | 5111 | 337212 | 0.544 | 0.084 | - | 5111 | 334111 | 0.284 | 0.0566 | - | 5111 | 334112 | 0.37 | 0.014716 | - | 5111 | 33411A | 0.362 | 0.01698 | - | 5111 | 511200 | 0.101 | 0.194704 | - | 5111 | 333315 | 0.623 | 0.001044 | - | 5111 | 3259A0 | 1.08 | 0.004194 | - | 5111 | 334300 | 0.549 | 0.000762 | - | 5111 | 322230 | 0.81 | 0.122 | - | 5111 | 322230 | 0.81 | 0.145 | - | 5111 | 322230 | 0.81 | 0.077645 | - | 5111 | 339940 | 0.535 | 0.078175 | - | 5111 | 325910 | 1.2 | 0.10918 | - | 5111 | 33331A | 0.567 | 0.002556 | - | 5111 | 333315 | 0.623 | 0.002201 | - | 5111 | 334111 | 0.284 | 0.0426 | - | 5111 | 334112 | 0.37 | 0.011005 | - | 5111 | 33411A | 0.362 | 0.012638 | - | 5111 | 323110 | 0.546 | 0.010505 | - | 5111 | 323120 | 0.358 | 0.000495 | - | 5111 | 532400 | 0.245 | 0.004251 | - | 5111 | 812900 | 0.22 | 0.001599 | - | 5111 | 532A00 | 0.23 | 0.001755 | - | 5111 | 561400 | 0.186 | 0.005395 | - | 5732 | 334300 | 0.549 | 0.25 | - | 5732 | 33411A | 0.362 | 0.5 | - | 5732 | 334210 | 1.6 | 0.2 | - | 5812 | 722000 | 0.8 | 1 | - | 3504 | 7211A0 | 0.559 | 1 | - | 5172 | 324110 | 2 | 0.8 | - | 5172 | 324121 | 1.3 | 0.05 | - | 5172 | 324122 | 0.9 | 0.05 | - | 5172 | 324191 | 0.2 | 0.05 | - | 5172 | 324199 | 1.2 | 0.05 | + | mcc | io_code | share | + | 3504 | 19 | 0.559 | + | 5111 | 1 | 0.27916245 | + | 5111 | 3 | 0.00573573 | + | 5111 | 4 | 0.041823625 | + | 5111 | 5 | 0.000650412 | + | 5111 | 6 | 0.002021635 | + | 5111 | 7 | 0.131016 | + | 5111 | 8 | 0.016074 | + | 5111 | 9 | 0.005444 | + | 5111 | 10 | 0.006146 | + | 5111 | 11 | 0.001041495 | + | 5111 | 12 | 0.00452952 | + | 5111 | 13 | 0.045696 | + | 5111 | 14 | 0.06289245 | + | 5111 | 15 | 0.00614676 | + | 5111 | 16 | 0.00017721 | + | 5111 | 17 | 0.00035178 | + | 5111 | 18 | 0.00040365 | + | 5172 | 20 | 1.6 | + | 5172 | 21 | 0.065 | + | 5172 | 22 | 0.045 | + | 5172 | 23 | 0.01 | + | 5172 | 24 | 0.06 | + | 5732 | 10 | 0.181 | + | 5732 | 12 | 0.13725 | + | 5732 | 25 | 0.32 | + | 5812 | 26 | 0.8 | - Scenario Outline: Emission factor from merchant category + Scenario Outline: Economic flows from merchant category code Given a purchase emitter And a characteristic "merchant_category.mcc" of "<mcc>" When the "industry_shares" committee is calculated And the "product_line_shares" committee is calculated And the "sector_shares" committee is calculated And the "emission_factors" committee is calculated Then the conclusion of the committee should have a record identified with "io_code" of "<io_code>" and having "factor" of "<emission_factor_share>" Examples: | mcc | io_code | emission_factor_share | - | 5111 | 337212 | 0.045696 | - | 5111 | 334111 | 0.0160744 | - | 5111 | 334112 | 0.00544492 | - | 5111 | 33411A | 0.00614676 | - | 5111 | 511200 | 0.019665104 | - | 5111 | 333315 | 0.000650412 | - | 5111 | 3259A0 | 0.00452952 | - | 5111 | 334300 | 0.000418338 | - | 5111 | 322230 | 0.09882 | - | 5111 | 322230 | 0.11745 | - | 5111 | 322230 | 0.06289245 | - | 5111 | 339940 | 0.041823625 | - | 5111 | 325910 | 0.131016 | - | 5111 | 33331A | 0.001449252 | - | 5111 | 333315 | 0.001371223 | - | 5111 | 334111 | 0.0120984 | - | 5111 | 334112 | 0.00407185 | - | 5111 | 33411A | 0.004574956 | - | 5111 | 323110 | 0.00573573 | - | 5111 | 323120 | 0.00017721 | - | 5111 | 532400 | 0.001041495 | - | 5111 | 812900 | 0.00035178 | - | 5111 | 532A00 | 0.00040365 | - | 5111 | 561400 | 0.00100347 | - | 5732 | 334300 | 0.13725 | - | 5732 | 33411A | 0.181 | - | 5732 | 334210 | 0.32 | - | 5812 | 722000 | 0.8 | - | 3504 | 7211A0 | 0.559 | - | 5172 | 324110 | 1.6 | - | 5172 | 324121 | 0.065 | - | 5172 | 324122 | 0.045 | - | 5172 | 324191 | 0.01 | - | 5172 | 324199 | 0.06 | + | 3504 | 19 | 0.559 | + | 5111 | 1 | 0.06289245 | + | 5111 | 3 | 0.00017721 | + | 5111 | 4 | 0.131016 | + | 5111 | 5 | 0.01052952 | + | 5111 | 6 | 0.000650412 | + | 5111 | 6 | 0.001371223 | + | 5111 | 7 | 0.001449252 | + | 5111 | 8 | 0.0120984 | + | 5111 | 8 | 0.0160744 | + | 5111 | 9 | 0.00407185 | + | 5111 | 9 | 0.00544492 | + | 5111 | 10 | 0.004574956 | + | 5111 | 10 | 0.00614676 | + | 5111 | 11 | 0.00035178 | + | 5111 | 12 | 0.000418338 | + | 5111 | 13 | 0.045696 | + | 5111 | 14 | 0.041823625 | + | 5111 | 15 | 0.019665104 | + | 5111 | 16 | 0.001041495 | + | 5111 | 17 | 0.00040365 | + | 5111 | 18 | 0.00100347 | + | 5172 | 20 | 1.6 | + | 5172 | 21 | 0.065 | + | 5172 | 22 | 0.045 | + | 5172 | 23 | 0.01 | + | 5172 | 24 | 0.06 | + | 5732 | 10 | 0.181 | + | 5732 | 12 | 0.13725 | + | 5732 | 25 | 0.32 | + | 5812 | 26 | 0.8 | - Scenario: Emission factor from default - Given a purchase emitter - When the "emission_factors" committee is calculated - Then the conclusion of the committee should have a record identified with "io_code" of "0" and having "factor" of "1" - Scenario Outline: Sector emissions from merchant id, cost, and date Given a purchase emitter And a characteristic "merchant.id" of "<merchant>" And a characteristic "cost" of "<cost>" And a characteristic "date" of "<date>" @@ -173,39 +226,39 @@ And the "emission_factors" committee is calculated And the "sector_emissions" committee is calculated Then the conclusion of the committee should include "<emission>" Examples: | merchant | io_code | cost | date | emission | - | 1 | 337212 | 100.00 | 2010-07-28 | 3.79 | - | 1 | 334111 | 100.00 | 2010-07-28 | 1.33 | - | 1 | 334112 | 100.00 | 2010-07-28 | 0.45 | - | 1 | 33411A | 100.00 | 2010-07-28 | 0.51 | - | 1 | 511200 | 100.00 | 2010-07-28 | 1.63 | - | 1 | 333315 | 100.00 | 2010-07-28 | 0.05 | - | 1 | 3259A0 | 100.00 | 2010-07-28 | 0.38 | - | 1 | 334300 | 100.00 | 2010-07-28 | 0.03 | - | 1 | 322230 | 100.00 | 2010-07-28 | 8.19 | - | 1 | 322230 | 100.00 | 2010-07-28 | 9.73 | - | 1 | 322230 | 100.00 | 2010-07-28 | 5.21 | - | 1 | 339940 | 100.00 | 2010-07-28 | 3.47 | - | 1 | 325910 | 100.00 | 2010-07-28 | 10.85 | - | 1 | 33331A | 100.00 | 2010-07-28 | 0.12 | - | 1 | 333315 | 100.00 | 2010-07-28 | 0.11 | - | 1 | 334111 | 100.00 | 2010-07-28 | 1.00 | - | 1 | 334112 | 100.00 | 2010-07-28 | 0.34 | - | 1 | 33411A | 100.00 | 2010-07-28 | 0.38 | - | 1 | 323110 | 100.00 | 2010-07-28 | 0.48 | - | 1 | 323120 | 100.00 | 2010-07-28 | 0.01 | - | 1 | 532400 | 100.00 | 2010-07-28 | 0.09 | - | 1 | 812900 | 100.00 | 2010-07-28 | 0.03 | - | 1 | 532A00 | 100.00 | 2010-07-28 | 0.03 | - | 1 | 561400 | 100.00 | 2010-07-28 | 0.08 | - | 2 | 334300 | 100.00 | 2010-07-28 | 11.37 | - | 2 | 33411A | 100.00 | 2010-07-28 | 15.00 | - | 2 | 334210 | 100.00 | 2010-07-28 | 26.51 | - | 3 | 722000 | 100.00 | 2010-07-28 | 66.28 | - | 4 | 7211A0 | 100.00 | 2010-07-28 | 46.31 | - | 5 | 324110 | 100.00 | 2010-07-28 | 132.56 | - | 5 | 324121 | 100.00 | 2010-07-28 | 5.39 | - | 5 | 324122 | 100.00 | 2010-07-28 | 3.73 | - | 5 | 324191 | 100.00 | 2010-07-28 | 0.83 | - | 5 | 324199 | 100.00 | 2010-07-28 | 4.97 | + | 1 | 1 | 100.00 | 2010-07-28 | 0.48 | + | 1 | 1 | 100.00 | 2010-07-28 | 5.21 | + | 1 | 1 | 100.00 | 2010-07-28 | 8.19 | + | 1 | 1 | 100.00 | 2010-07-28 | 9.73 | + | 1 | 3 | 100.00 | 2010-07-28 | 0.01 | + | 1 | 4 | 100.00 | 2010-07-28 | 10.85 | + | 1 | 5 | 100.00 | 2010-07-28 | 0.38 | + | 1 | 6 | 100.00 | 2010-07-28 | 0.05 | + | 1 | 6 | 100.00 | 2010-07-28 | 0.11 | + | 1 | 7 | 100.00 | 2010-07-28 | 0.12 | + | 1 | 8 | 100.00 | 2010-07-28 | 1.00 | + | 1 | 8 | 100.00 | 2010-07-28 | 1.33 | + | 1 | 9 | 100.00 | 2010-07-28 | 0.34 | + | 1 | 9 | 100.00 | 2010-07-28 | 0.45 | + | 1 | 10 | 100.00 | 2010-07-28 | 0.38 | + | 1 | 10 | 100.00 | 2010-07-28 | 0.51 | + | 1 | 11 | 100.00 | 2010-07-28 | 0.03 | + | 1 | 12 | 100.00 | 2010-07-28 | 0.03 | + | 1 | 13 | 100.00 | 2010-07-28 | 3.79 | + | 1 | 14 | 100.00 | 2010-07-28 | 3.47 | + | 1 | 15 | 100.00 | 2010-07-28 | 1.63 | + | 1 | 16 | 100.00 | 2010-07-28 | 0.09 | + | 1 | 17 | 100.00 | 2010-07-28 | 0.03 | + | 1 | 18 | 100.00 | 2010-07-28 | 0.08 | + | 2 | 10 | 100.00 | 2010-07-28 | 15.00 | + | 2 | 12 | 100.00 | 2010-07-28 | 11.37 | + | 2 | 25 | 100.00 | 2010-07-28 | 26.51 | + | 3 | 26 | 100.00 | 2010-07-28 | 66.28 | + | 4 | 19 | 100.00 | 2010-07-28 | 46.31 | + | 5 | 20 | 100.00 | 2010-07-28 | 132.56 | + | 5 | 21 | 100.00 | 2010-07-28 | 5.39 | + | 5 | 22 | 100.00 | 2010-07-28 | 3.73 | + | 5 | 23 | 100.00 | 2010-07-28 | 0.83 | + | 5 | 24 | 100.00 | 2010-07-28 | 4.97 |