def __init__(self, test, host, output_format=None):
        """

        :rtype : object
        """

        self.passed = 0
        self.failed = 0
        self.duration_ms = 0
        try:
            validictory.validate(test, SCHEMA)
            LOG.debug("Valid schema")
        except ValueError as error:
            LOG.error("Error, invalid test format: {0}.  Tests now use v0.2 format. v0.1 branch is still available."
                      .format(error))
            raise

        try:
            self.port = test["port"]
        except (AttributeError, KeyError):
            print("Warning: No port definition found in the first test, using port 80 as default.")
            try:
                if test["protocol"] == "https":
                    self.port = 443
                else:
                    self.port = 80
            except (AttributeError, KeyError):
                self.port = 80

        self.output = Output(output_format=output_format)
        LOG.debug("Test: {0}".format(test))
        test_defaults = dict(inputs=dict(allow_redirects=False, timeout=30),
                             method="get",
                             outcomes=dict(expect_status_code=200, colour_output=True))

        host_overrides = get_host_overrides.get_host_overrides(host, self.port)

        if host_overrides['hostname'] is not None:
            self.host = host_overrides['hostname']
        else:
            self.host = host
        intermediate_dict = deepupdate(test_defaults, host_overrides)

        final_dict = deepupdate(intermediate_dict, test)

        if "tcp_test" in test and test["tcp_test"]:
            tcptest.tcp_test(self.host, self.port)

        try:
            verify = final_dict["inputs"]["verify"]
        except (AttributeError, KeyError):
            verify = None
        try:
            proto = final_dict['protocol']
        except (AttributeError, KeyError):
            proto = None

        (self.verify, self.verify_specified) = get_verify.get_verify(verify, proto)

        self.test = deepcopy(final_dict)
        LOG.debug("Test with defaults: {0}".format(self.test))
        if "verify" in self.test["inputs"]:
            del self.test["inputs"]["verify"]
        self.inputs = deepcopy(self.test['inputs'])
        request_url_format = '{protocol}://{host}:{port}{uri}'
        try:
            self.inputs['url'] = request_url_format.format(protocol=self.test['protocol'], host=self.host,
                                                           port=self.test['port'],
                                                           uri=self.test['uri'])
        except KeyError:
            self.inputs['url'] = request_url_format.format(protocol=self.test['protocol'], host=self.host,
                                                           port=self.test['port'],
                                                           uri='')
        LOG.debug("Testing {0}".format(self.inputs['url']))
        self.output.append("-" * OUTPUT_WIDTH)

        this_name = ("{0:^" + str(OUTPUT_WIDTH) + "}").format(self.test['name'][:OUTPUT_WIDTH])
        self.output.append(this_name)
        this_url = ("{0:^" + str(OUTPUT_WIDTH) + "}").format(self.inputs["url"][:OUTPUT_WIDTH])
        self.output.append(this_url)
        self.output.append(self.__repr__())
        self.output.append("-" * OUTPUT_WIDTH)
        self.output.append(self.inputs, sec='request_inputs')
        self.run()
dataset/ETHPy150Open sky-shiny/smolder/charcoal/charcoal.py/Charcoal.__init__/original