Beispiel #1
0
    def test_instantiate_empty_entrypoint(self):
        doc = OBInstance("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.is_concept_writable('solar:TypeOfDevice'))
        # AppraisalCounterparties is not allowed in CutSheets:
        self.assertFalse(
            doc.is_concept_writable('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").get_axes(), [
                "solar:ProductIdentifierAxis",
                "solar:InverterPowerLevelPercentAxis"
            ])
        self._check_arrays_equivalent(
            doc.get_table("solar:CutSheetDetailsTable").get_axes(),
            ["solar:ProductIdentifierAxis", "solar:TestConditionAxis"])
Beispiel #2
0
    def test_can_write_concept(self):
        doc = OBInstance("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.is_concept_writable('solar:ProductIdentifierModuleAbstract'))
        self.assertTrue(doc.is_concept_writable('solar:TypeOfDevice'))
        self.assertFalse(
            doc.is_concept_writable('solar:CutSheetDetailsLineItems'))

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

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