Esempio n. 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"])
Esempio n. 2
0
    def test_hypercube_rejects_out_of_domain_axis_values(self):
        # Try passing in something as a value for TestConditionAxis that is not
        # one of the enumerated Members; it should be rejected:

        doc = Entrypoint("CutSheet", self.taxonomy)
        table = doc.get_table("solar:CutSheetDetailsTable")

        self.assertTrue(
            table.axis_value_within_domain(
                "solar:TestConditionAxis",
                "solar:StandardTestConditionMember"))

        self.assertFalse(
            table.axis_value_within_domain(
                "solar:TestConditionAxis",
                "solar:InverterPowerLevel100PercentMember"))

        concept = 'solar:InverterOutputRatedPowerAC'
        context = Context(
            duration="forever",
            ProductIdentifierAxis="placeholder",
            InverterPowerLevelPercentAxis='solar:StandardTestConditionMember')
        # not a valid value for InverterPowerLevelPercentAxis
        with self.assertRaises(Exception):
            doc.sufficient_context(concept, context)
Esempio n. 3
0
    def test_hypercube_store_context(self):
        doc = Entrypoint("CutSheet", self.taxonomy)
        table = doc.get_table("solar:InverterPowerLevelTable")

        c1 = table.store_context(
            Context(duration="forever",
                    entity="JUPITER",
                    ProductIdentifierAxis="ABCD",
                    InverterPowerLevelPercentAxis=
                    'solar:InverterPowerLevel50PercentMember'))
        self.assertEqual(c1.get_id(), "solar:InverterPowerLevelTable_0")
        c2 = table.store_context(
            Context(duration="forever",
                    entity="JUPITER",
                    ProductIdentifierAxis="ABCD",
                    InverterPowerLevelPercentAxis=
                    'solar:InverterPowerLevel50PercentMember'))  # Same
        self.assertIs(c1, c2)
        c3 = table.store_context(
            Context(duration="forever",
                    entity="JUPITER",
                    ProductIdentifierAxis="ABCD",
                    InverterPowerLevelPercentAxis=
                    'solar:InverterPowerLevel75PercentMember'))  # Different
        self.assertIsNot(c1, c3)
Esempio n. 4
0
    def test_hypercube_can_identify_axis_domains(self):
        doc = Entrypoint("CutSheet", self.taxonomy)
        table = doc.get_table("solar:CutSheetDetailsTable")

        domain = table.get_domain("solar:ProductIdentifierAxis")
        self.assertEqual(domain, "solar:ProductIdentifierDomain")

        domain = table.get_domain("solar:TestConditionAxis")
        self.assertEqual(domain, "solar:TestConditionDomain")