예제 #1
0
    def test_instantiate_empty_entrypoint(self):
        doc = Entrypoint("CutSheet", self.taxonomy)

        # The newly initialized CutSheet should have a correct list of
        # allowable concepts as defined by the taxonomy for CutSheets.

        # TypeOfDevice is allowed in CutSheets:
        self.assertTrue(doc.can_write_concept('solar:TypeOfDevice'))
        # AppraisalCounterparties is not allowed in CutSheets:
        self.assertFalse(
            doc.can_write_concept('solar:AppraisalCounterparties'))

        # The newly initialized CutSheet should have a correct list of tables
        # and each table should have a correct list of axes, as defined by
        # the taxonomy for CutSheets:
        tables = doc.get_table_names()
        self._check_arrays_equivalent(
            tables,
            ["solar:InverterPowerLevelTable", "solar:CutSheetDetailsTable"])
        self._check_arrays_equivalent(
            doc.get_table("solar:InverterPowerLevelTable").axes(), [
                "solar:ProductIdentifierAxis",
                "solar:InverterPowerLevelPercentAxis"
            ])
        self._check_arrays_equivalent(
            doc.get_table("solar:CutSheetDetailsTable").axes(),
            ["solar:ProductIdentifierAxis", "solar:TestConditionAxis"])
예제 #2
0
    def test_can_write_concept(self):
        doc = Entrypoint("CutSheet", self.taxonomy)

        # Not every concept is writable. For instance, we shouldn't be able
        # to write a value for an Abstract concept, a LineItem group, an Axis,
        # a Domain, etc. even though those are part of this entrypoint.
        self.assertFalse(
            doc.can_write_concept('solar:ProductIdentifierModuleAbstract'))
        self.assertTrue(doc.can_write_concept('solar:TypeOfDevice'))
        self.assertFalse(
            doc.can_write_concept('solar:CutSheetDetailsLineItems'))

        self.assertFalse(doc.can_write_concept('solar:CutSheetDetailsTable'))
        self.assertFalse(doc.can_write_concept('solar:TestConditionDomain'))

        self.assertFalse(doc.can_write_concept('solar:ProductIdentifierAxis'))
        self.assertTrue(doc.can_write_concept('solar:ProductIdentifier'))