def test_insert_labels(self): calcs = xbrl.get_calcs(self.cal_root) log = xbrl.calc_values(self.root, calcs) label_log = xbrl.insert_labels(self.lab_root, log) debt = [ "http://www.example.com/role/DebtLongTermDebtDetails", "Long-term Debt, Excluding Current Maturities", "us-gaap_LongTermDebtNoncurrent", "I2013Q1", Decimal("2989"), Decimal("11") ] self.assertIn(debt, label_log) self.assertEqual(len(label_log), 23)
def test_get_calcs(self): linkrole = "http://www.example.com/role/BalanceSheetComponents" \ "InventoriesDetails" total = "us-gaap_InventoryNet" elems_to_add = [ ("us-gaap_InventoryFinishedGoodsNetOfReserves", "1"), ("us-gaap_InventoryWorkInProcessAndRawMaterialsNetOfReserves", "1") ] calc_linkroles = xbrl.get_calcs(self.cal_root) total_elements = [] for calc_linkrole in calc_linkroles: for calc_total in calc_linkroles[calc_linkrole]: total_elements.append(calc_total) self.assertEqual(11, len(calc_linkroles)) self.assertIn(total, calc_linkroles[linkrole]) self.assertEqual(32, len(total_elements)) self.assertEqual(elems_to_add, calc_linkroles[linkrole][total])
def test_calc_values(self): debts = [[ "http://www.example.com/role/DebtLongTermDebtDetails", "us-gaap_LongTermDebtNoncurrent", "I2013Q1", Decimal("2989"), Decimal("11") ], [ "http://www.example.com/role/DebtAdditionalInformationDetails", "us-gaap_DebtWeightedAverageInterestRate", "I2013Q1", Decimal("0.9843"), Decimal("0.05734") ]] calcs = xbrl.get_calcs(self.cal_root) log = xbrl.calc_values(self.root, calcs) for debt in debts: self.assertIn(debt, log) self.assertEqual(len(log), 23)
def test_calc_values(self): debts = [ [ "http://www.example.com/role/DebtLongTermDebtDetails", "us-gaap_LongTermDebtNoncurrent", "I2013Q1", Decimal("2989"), Decimal("11") ], [ "http://www.example.com/role/DebtAdditionalInformationDetails", "us-gaap_DebtWeightedAverageInterestRate", "I2013Q1", Decimal("0.9843"), Decimal("0.05734") ] ] calcs = xbrl.get_calcs(self.cal_root) log = xbrl.calc_values(self.root, calcs) for debt in debts: self.assertIn(debt, log) self.assertEqual(len(log), 23)