def test_requirement_template(database): # Setup database.requirement_template["Use A"] = _make_req("A")[1] use_a = RequirementTemplate("Use A") # Run as_set = use_a.as_set(database) # Assert assert as_set == make_single_set(_make_req("A")) assert hash(use_a)
def test_requirement_template_nested(database): # Setup use_a = RequirementTemplate(database, "Use A") use_b = RequirementTemplate(database, "Use B") database.requirement_template["Use A"] = _req("A") database.requirement_template["Use B"] = RequirementOr([use_a, _req("B")]) # Run as_set = use_b.as_set # Assert assert as_set == RequirementSet([ RequirementList([_req("A")]), RequirementList([_req("B")]), ])
def _create_default_template_requirement( resource_database: ResourceDatabase) -> RequirementTemplate: template_name = None for template_name in resource_database.requirement_template.keys(): break if template_name is None: raise RuntimeError("No templates?!") return RequirementTemplate(resource_database, template_name)
def test_pretty_print_requirement_array_combinable( mock_print_requirement: MagicMock, echoes_resource_database): mock_print_requirement.return_value = ["a", "b"] array = RequirementAnd([ ResourceRequirement(echoes_resource_database.item[0], 1, False), RequirementTemplate("Shoot Sunburst"), ]) # Run result = list(pretty_print.pretty_print_requirement_array(array, 3)) # Assert assert result == [(3, "Power Beam and Shoot Sunburst")] mock_print_requirement.assert_not_called()
def current_requirement(self) -> RequirementTemplate: return RequirementTemplate( self.resource_database, self.template_name_combo.currentText(), )
def read_requirement_template( data: Dict, resource_database: ResourceDatabase) -> RequirementTemplate: return RequirementTemplate(data["data"])
def current_requirement(self) -> RequirementTemplate: return RequirementTemplate(self.template_name_combo.currentText())