mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-12 21:48:25 +03:00
Restore tests
This commit is contained in:
parent
e9b134ab79
commit
fb63c8afc8
@ -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
|
||||
*/
|
@ -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 ############################
|
||||
|
Loading…
Reference in New Issue
Block a user