py-xbrl
py-xbrl copied to clipboard
Equals method for all fact classes
Add an eq() method to all fact classes to test for equality
If it helps, I've been using the code below to check for fact equality:
def fact_compare(first:AbstractFact, second:AbstractFact):
if type(first) != type(second):
return False
if first.value != second.value:
return False
if first.xml_id != second.xml_id:
return False
if first.footnote != second.footnote:
return False
if isinstance(first, NumericFact):
first:NumericFact = first
second:NumericFact = second
if first.decimals != second.decimals:
return False
if first.unit != second.unit:
return False
else:
first:TextFact = first
second:TextFact = second
if not context_compare(first.context, second.context):
return False
if not concept_compare(first.concept, second.concept):
return False
return True