From fb63c8afc8a6c00960d58896664e61b9b2952f22 Mon Sep 17 00:00:00 2001 From: Denis Merigoux Date: Fri, 19 Feb 2021 09:09:13 +0100 Subject: [PATCH] Restore tests --- .../section_121_for_liane_class.catala_en | 63 ------------------- .../tests/test_section_121.catala_en | 4 ++ 2 files changed, 4 insertions(+), 63 deletions(-) delete mode 100644 examples/us_tax_code/section_121_for_liane_class.catala_en diff --git a/examples/us_tax_code/section_121_for_liane_class.catala_en b/examples/us_tax_code/section_121_for_liane_class.catala_en deleted file mode 100644 index 9ec10d6b..00000000 --- a/examples/us_tax_code/section_121_for_liane_class.catala_en +++ /dev/null @@ -1,63 +0,0 @@ -@@US Tax Code@@ - -@@Section 121@@+ - -@@Begin metadata@@ -/* -declaration structure Period: - data begin content date - data end content date - -declaration scope Section121: - context income_excluded_from_gross_income content money - context gain_from_sale_or_exchange_of_property content money - context date_of_sale_or_exchange content date - context aggregate_periods_from_last_five_years content duration - depends on collection Period - - # These inputs are facts and circumstance - context property_ownage content collection Period - context property_usage_as_principal_residence - content collection Period -*/ -@@End metadata@@ - -@(a) Exclusion@ - -Gross income shall not include gain from the sale or exchange of property if, -during the 5-year period ending on the date of the sale or exchange, such -property has been owned and used by the taxpayer as the taxpayer’s principal -residence for periods aggregating 2 years or more. -/* -scope Section121: - # Here we aggregate over all the periods of the collection. For - # each period, three cases: - # - either the period began less that 5 years before the - # date_of_sale_or_exchange in which case we count if full - # - either the period ended more that 5 years before the - # date_of_sale_or_exchange in which case we don't count it - # - either the 5 years mark is inside the period and we only - # count the half after 5 years - definition aggregate_periods_from_last_five_years of periods equals - sum duration for period in periods of ( - if date_of_sale_or_exchange <=@ period.begin +@ 5 year then - period.end -@ period.begin - else (if date_of_sale_or_exchange >=@ period.end +@ 5 year then - 0 day - else ((period.end +@ 5 year) -@ date_of_sale_or_exchange)) - ) - - label base_case - definition income_excluded_from_gross_income equals $0 - - # Regulation 1.121-1(c)(1): 2 years = 730 days - # Regulation 1.121-1(c)(1): the periods of ownage and usage - # don't have to overlap - exception base_case - definition income_excluded_from_gross_income under condition - aggregate_periods_from_last_five_years of property_ownage >=^ 730 day and - aggregate_periods_from_last_five_years of - property_usage_as_principal_residence <=^ 730 day - consequence equals - gain_from_sale_or_exchange_of_property -*/ diff --git a/examples/us_tax_code/tests/test_section_121.catala_en b/examples/us_tax_code/tests/test_section_121.catala_en index aa2ceeb6..f4ae66f2 100644 --- a/examples/us_tax_code/tests/test_section_121.catala_en +++ b/examples/us_tax_code/tests/test_section_121.catala_en @@ -70,6 +70,7 @@ scope Test1: definition scope121a.property_ownage equals [data_.period_four_years_recent] definition scope121a.property_usage_as_principal_residence equals [data_.period_four_years_recent] + definition scope121a.other_section_121a_sale equals NoOtherSaleWhereSection121aApplied assertion scope121a.requirements_met declaration scope Test2: @@ -83,6 +84,7 @@ scope Test2: definition scope121a.property_ownage equals [data_.period_four_years_recent] definition scope121a.property_usage_as_principal_residence equals [data_.period_one_year_recent] + definition scope121a.other_section_121a_sale equals NoOtherSaleWhereSection121aApplied assertion not scope121a.requirements_met declaration scope Test3: @@ -96,6 +98,7 @@ scope Test3: definition scope121a.property_ownage equals [data_.period_four_years_recent] definition scope121a.property_usage_as_principal_residence equals [data_.period_two_years_middle] + definition scope121a.other_section_121a_sale equals NoOtherSaleWhereSection121aApplied assertion not scope121a.requirements_met declaration scope Test4: @@ -109,6 +112,7 @@ scope Test4: definition scope121a.property_ownage equals [data_.period_four_years_recent] definition scope121a.property_usage_as_principal_residence equals [data_.period_two_years_middle; data_.period_one_year_recent] + definition scope121a.other_section_121a_sale equals NoOtherSaleWhereSection121aApplied assertion scope121a.requirements_met ###################### Testing Section121TwoPersons ############################