Repository: jerryscript-project/jerryscript
File: tools/runners/test262-harness.py (Python)

Code before:
    def parse_test_record(self):
        with open(self.full_path, "rb") as file_desc:
            full_test = file_desc.read()

        match = TEST_RE.search(full_test)
        header = match.group('header')
        self.test = match.group('test1') + match.group('test2')

        match = YAML_INCLUDES_RE.search(header)
        if match:
            self.test_record["includes"] = [inc.strip() for inc in match.group('includes').split(',') if inc]
        else:
            match = YAML_INCLUDES_LEGACY_RE.search(header)
            self.test_record["includes"] = [inc.strip() for inc in match.groups()[0].split('-') if inc] if match else []

        match = YAML_FLAGS_RE.search(header)
        if match:
            for flag in match.group('flags').split(','):
                if flag.strip():
                    self.test_record[flag.strip()] = ""

        match = YAML_NEGATIVE_RE.search(header)
        if match and match.group("phase") and match.group("type"):
            self.test_record["negative"] = {
                "phase" : match.group("phase"),
                "type" : match.group("type")}
        else:
            match = YAML_NEGATIVE_LEGACY_RE.search(header)
            if match:
                self.test_record["negative"] = match.group("type")

    def negative_match(self, stderr):
        neg = re.compile(self.get_negative_type())
        return re.search(neg, stderr)

    def get_negative(self):
        if not self.is_negative():
            return None
        return self.test_record["negative"]

    def get_negative_type(self):
        negative = self.get_negative()
        if isinstance(negative, dict) and "type" in negative:
            return negative["type"]
        return negative

    def get_negative_phase(self):
        negative = self.get_negative()
        return negative and "phase" in negative and negative["phase"]

    def get_name(self):

Review comment (suggestion):
I think the closing bracket should be in the next line:

```
self.test_record["negative"] = {
    "phase" : match.group("phase"),
    "type" : match.group("type")
}
```

Code after:
        header = match.group("header")
        self.test = match.group("test1") + match.group("test2")

        match = YAML_INCLUDES_RE.search(header)

        if match:
            self.test_record["includes"] = [inc.strip() for inc in match.group("includes").split(",") if inc]

        match = YAML_FLAGS_RE.search(header)
        self.test_record["flags"] = [flag.strip() for flag in match.group("flags").split(",") if flag] if match else []

        match = YAML_NEGATIVE_RE.search(header)
        if match:
            self.test_record["negative"] = {
                "phase" : match.group("phase"),
                "type" : match.group("type")
            }

    def negative_match(self, stderr):
        neg = re.compile(self.get_negative_type())
        return re.search(neg, stderr)

    def get_negative(self):
        if not self.is_negative():
            return None
        return self.test_record["negative"]

    def get_negative_type(self):
        negative = self.get_negative()
        if isinstance(negative, dict) and "type" in negative:
            return negative["type"]
        return negative

    def get_negative_phase(self):
        negative = self.get_negative()
        return negative and "phase" in negative and negative["phase"]

    def get_name(self):
        return path.join(*self.name)

    def get_mode(self):
        if self.strict_mode:
            return "strict mode"
        return "non-strict mode"

    def get_path(self):
        return self.name

    def is_negative(self):
        return 'negative' in self.test_record