# Path: hgvs/exceptions.py
# class HGVSParseError(HGVSError):
#     pass


import os
import pprint
import unittest
import pytest
import hgvs.parser
from hgvs.exceptions import HGVSParseError


class Test_Position(unittest.TestCase):
    longMessage = True

    @classmethod
    def setUpClass(cls):
        cls.parser = hgvs.parser.Parser()

    def test_parser_parse_shorthand(self):
        v = "NM_01234.5:c.22+1A>T"
        assert self.parser.parse_hgvs_variant(v) == self.parser.parse(v)

    def test_parser_gauntlet(self):
        fn = os.path.join(os.path.dirname(__file__), "data", "gauntlet")
        for var in open(fn, "r"):
            var = var.strip()
            if var.startswith("#") or var == "":
                continue
            v = self.parser.parse_hgvs_variant(var)
            self.assertEqual(var, v.format(conf={'max_ref_length': None}),
                             "parse-format roundtrip failed:" + pprint.pformat(v.posedit))

    @pytest.mark.quick
    def test_parser_reject(self):
        fn = os.path.join(os.path.dirname(__file__), "data", "reject")
        for var in open(fn, "r"):
            var, msg = var.strip().split("\t")
            if var.startswith("#") or var == "":
                continue

# Path: hgvs/exceptions.py
# class HGVSParseError(HGVSError):
#     pass


# Path: tests/test_hgvs_parser.py
import os
import pprint
import unittest
import pytest
import hgvs.parser
from hgvs.exceptions import HGVSParseError



class Test_Position(unittest.TestCase):
    longMessage = True

    @classmethod
    def setUpClass(cls):
        cls.parser = hgvs.parser.Parser()

    def test_parser_parse_shorthand(self):
        v = "NM_01234.5:c.22+1A>T"
        assert self.parser.parse_hgvs_variant(v) == self.parser.parse(v)

    def test_parser_gauntlet(self):
        fn = os.path.join(os.path.dirname(__file__), "data", "gauntlet")
        for var in open(fn, "r"):
            var = var.strip()
            if var.startswith("#") or var == "":
                continue
            v = self.parser.parse_hgvs_variant(var)
            self.assertEqual(var, v.format(conf={'max_ref_length': None}),
                             "parse-format roundtrip failed:" + pprint.pformat(v.posedit))

    @pytest.mark.quick
    def test_parser_reject(self):
        fn = os.path.join(os.path.dirname(__file__), "data", "reject")
        for var in open(fn, "r"):
            var, msg = var.strip().split("\t")
            if var.startswith("#") or var == "":
                continue

            with self.assertRaises(HGVSParseError):