import gzip
import json

from django.conf import settings as s
from django.test import TestCase, tag
from utilities.chem import FormatConverter
from envipy_ambit import apply
from rdkit import Chem
from rdkit.Chem.MolStandardize import rdMolStandardize


@tag("slow")
class RuleApplicationTest(TestCase):
    def setUp(self):
        self.total_errors = 0

    @classmethod
    def setUpClass(cls):
        super(RuleApplicationTest, cls).setUpClass()
        cls.data = json.load(gzip.open(s.BASE_DIR / "fixtures" / "ambit_rules.json.gz", "rb"))
        cls.error_smiles = list()
        from collections import defaultdict

        cls.triggered = defaultdict(lambda: defaultdict(lambda: 0))

    @classmethod
    def tearDownClass(cls):
        super().tearDownClass()
        print(f"\nTotal Errors across Rules {len(cls.error_smiles)}")
        # print(cls.error_smiles)
        from pprint import pprint
        from collections import Counter

        pprint(Counter(cls.error_smiles))
        # import json
        # pprint(json.loads(json.dumps(cls.triggered)))

    def tearDown(self):
        super().tearDown()
        # print(f"\nTotal errors {self.total_errors}")

    @staticmethod
    def normalize_smiles(smiles):
        m1 = Chem.MolFromSmiles(smiles)
        if m1 is None:
            print("Couldnt read smi: ", smiles)
            return smiles
        Chem.RemoveStereochemistry(m1)
        # Normalizer takes care of charge/tautomer/resonance standardization
        normalizer = rdMolStandardize.Normalizer()
        return Chem.MolToSmiles(normalizer.normalize(m1), canonical=True)

    @staticmethod
    def run_both_engines(smiles, smirks):
        ambit_res = apply(smirks, smiles)

        ambit_res = list(
            set(
                [
                    RuleApplicationTest.normalize_smiles(str(x))
                    for x in FormatConverter.sanitize_smiles([str(s) for s in ambit_res])[0]
                ]
            )
        )

        products = FormatConverter.apply(smiles, smirks)

        all_rdkit_prods = []
        for ps in products:
            for p in ps:
                all_rdkit_prods.append(p)

        all_rdkit_prods = list(set(all_rdkit_prods))

        all_rdkit_res = list(
            set(
                [
                    RuleApplicationTest.normalize_smiles(str(x))
                    for x in FormatConverter.sanitize_smiles([str(s) for s in all_rdkit_prods])[0]
                ]
            )
        )

        return ambit_res, 0, all_rdkit_res, 0

    def run_bt_test(self, bt_rule_name):
        bt_rule = self.data[bt_rule_name]
        smirks = bt_rule["smirks"]

        res = True

        all_prods = set()
        for comp in bt_rule["compounds"]:
            smi = comp["smiles"]

            ambit_smiles, ambit_errors, rdkit_smiles, rdkit_errors = self.run_both_engines(
                smi, smirks
            )

            for x in ambit_smiles:
                all_prods.add(x)

            # TODO mode "intersection"
            # partial_res = (len(set(ambit_smiles).intersection(set(rdkit_smiles))) > 0) or (len(ambit_smiles) == 0)
            # FAILED (failures=18)

            # TODO mode = "full ambit"
            # partial_res = len(set(ambit_smiles).intersection(set(rdkit_smiles))) == len(set(ambit_smiles))
            # FAILED (failures=22)

            # TODO mode = "equality"
            partial_res = set(ambit_smiles) == set(rdkit_smiles)
            # FAILED (failures=30)

            if len(ambit_smiles) and not partial_res:
                print(f"""
                    BT {bt_rule_name}
                    SMIRKS {bt_rule["smirks"]}
                    Compound {comp["smiles"]}
                    Num ambit {len(set(ambit_smiles))}
                    Num rdkit {len(set(rdkit_smiles))}
                    Num Intersection A {len(set(ambit_smiles).intersection(set(rdkit_smiles)))}
                    Num Intersection B {len(set(rdkit_smiles).intersection(set(ambit_smiles)))}
                    Difference A: {set(ambit_smiles).difference(set(rdkit_smiles))}
                    Difference B: {set(rdkit_smiles).difference(set(ambit_smiles))}
                    ambit products {ambit_smiles}
                    rdkit products {rdkit_smiles}
                    ambit_errors: {ambit_errors}
                    rdkit_errors: {rdkit_errors}
                """)

            if not partial_res:
                self.error_smiles.append(comp["smiles"])
                self.total_errors += 1

            res &= partial_res

        self.assertTrue(res)

    def test_bt0349_3023(self):
        self.run_bt_test("bt0349-3023")

    def test_bt0306_3442(self):
        self.run_bt_test("bt0306-3442")

    def test_bt0342_4298_1(self):
        self.run_bt_test("bt0342-4298.1")

    def test_bt0064_3707(self):
        self.run_bt_test("bt0064-3707")

    def test_bt0108_470(self):
        self.run_bt_test("bt0108-470")

    def test_bt0231_1871_2(self):
        self.run_bt_test("bt0231-1871.2")

    def test_bt0374_4148(self):
        self.run_bt_test("bt0374-4148")

    def test_bt0417_3777(self):
        self.run_bt_test("bt0417-3777")

    def test_bt0153_3077(self):
        self.run_bt_test("bt0153-3077")

    def test_bt0213_3524(self):
        self.run_bt_test("bt0213-3524")

    def test_bt0257_3855_2(self):
        self.run_bt_test("bt0257-3855.2")

    def test_bt0037_3717(self):
        self.run_bt_test("bt0037-3717")

    def test_bt0102_4062(self):
        self.run_bt_test("bt0102-4062")

    def test_bt0431_4039(self):
        self.run_bt_test("bt0431-4039")

    def test_bt0444_4310(self):
        self.run_bt_test("bt0444-4310")

    def test_bt0242_3803(self):
        self.run_bt_test("bt0242-3803")

    def test_bt0231_1871_3(self):
        self.run_bt_test("bt0231-1871.3")

    def test_bt0388_4159(self):
        self.run_bt_test("bt0388-4159")

    def test_bt0022_2833(self):
        self.run_bt_test("bt0022-2833")

    def test_bt0393_3367(self):
        self.run_bt_test("bt0393-3367")

    def test_bt0282_3656(self):
        self.run_bt_test("bt0282-3656")

    def test_bt0399_3488(self):
        self.run_bt_test("bt0399-3488")

    def test_bt0330_3930(self):
        self.run_bt_test("bt0330-3930")

    def test_bt0363_4185(self):
        self.run_bt_test("bt0363-4185")

    def test_bt0243_4301(self):
        self.run_bt_test("bt0243-4301")

    def test_bt0407_3651(self):
        self.run_bt_test("bt0407-3651")

    def test_bt0055_3469_3(self):
        self.run_bt_test("bt0055-3469.3")

    def test_bt0230_3525(self):
        self.run_bt_test("bt0230-3525")

    def test_bt0051_3151(self):
        self.run_bt_test("bt0051-3151")

    def test_bt0212_3523(self):
        self.run_bt_test("bt0212-3523")

    def test_bt0005_4282(self):
        self.run_bt_test("bt0005-4282")

    def test_bt0037_3718(self):
        self.run_bt_test("bt0037-3718")

    def test_bt0418_3842(self):
        self.run_bt_test("bt0418-3842")

    def test_bt0062_925(self):
        self.run_bt_test("bt0062-925")

    def test_bt0428_3946(self):
        self.run_bt_test("bt0428-3946")

    def test_bt0420_3811(self):
        self.run_bt_test("bt0420-3811")

    def test_bt0351_3769(self):
        self.run_bt_test("bt0351-3769")

    def test_bt0383_3210(self):
        self.run_bt_test("bt0383-3210")

    def test_bt0421_3907(self):
        self.run_bt_test("bt0421-3907")

    def test_bt0079_1087(self):
        self.run_bt_test("bt0079-1087")

    def test_bt0013_4165_2(self):
        self.run_bt_test("bt0013-4165.2")

    def test_bt0337_3542(self):
        self.run_bt_test("bt0337-3542")

    def test_bt0325_3638(self):
        self.run_bt_test("bt0325-3638")

    def test_bt0435_4212(self):
        self.run_bt_test("bt0435-4212")

    def test_bt0071_4150(self):
        self.run_bt_test("bt0071-4150")

    def test_bt0351_3944(self):
        self.run_bt_test("bt0351-3944")

    def test_bt0270_3919(self):
        self.run_bt_test("bt0270-3919")

    def test_bt0349_2798(self):
        self.run_bt_test("bt0349-2798")

    def test_bt0154_1367(self):
        self.run_bt_test("bt0154-1367")

    def test_bt0401_3575(self):
        self.run_bt_test("bt0401-3575")

    def test_bt0430_4011(self):
        self.run_bt_test("bt0430-4011")

    def test_bt0337_3545(self):
        self.run_bt_test("bt0337-3545")

    def test_bt0389_3302(self):
        self.run_bt_test("bt0389-3302")

    def test_bt0346_2639(self):
        self.run_bt_test("bt0346-2639")

    def test_bt0268_3530(self):
        self.run_bt_test("bt0268-3530")

    def test_bt0379_3190(self):
        self.run_bt_test("bt0379-3190")

    def test_bt0013_4165(self):
        self.run_bt_test("bt0013-4165")

    def test_bt0351_2780(self):
        self.run_bt_test("bt0351-2780")

    def test_bt0353_4167(self):
        self.run_bt_test("bt0353-4167")

    def test_bt0291_1129(self):
        self.run_bt_test("bt0291-1129")

    def test_bt0103_3648(self):
        self.run_bt_test("bt0103-3648")

    def test_bt0044_3232(self):
        self.run_bt_test("bt0044-3232")

    def test_bt0110_3663(self):
        self.run_bt_test("bt0110-3663")

    def test_bt0107_3557(self):
        self.run_bt_test("bt0107-3557")

    def test_bt0034_2448(self):
        self.run_bt_test("bt0034-2448")

    def test_bt0073_3591(self):
        self.run_bt_test("bt0073-3591")

    def test_bt0219_4295(self):
        self.run_bt_test("bt0219-4295")

    def test_bt0066_3867(self):
        self.run_bt_test("bt0066-3867")

    def test_bt0295_3520(self):
        self.run_bt_test("bt0295-3520")

    def test_bt0021_3858(self):
        self.run_bt_test("bt0021-3858")

    def test_bt0177_3159(self):
        self.run_bt_test("bt0177-3159")

    def test_bt0318_3664(self):
        self.run_bt_test("bt0318-3664")

    def test_bt0080_4217(self):
        self.run_bt_test("bt0080-4217")

    def test_bt0181_1278(self):
        self.run_bt_test("bt0181-1278")

    def test_bt0254_4224_2(self):
        self.run_bt_test("bt0254-4224.2")

    def test_bt0237_2957(self):
        self.run_bt_test("bt0237-2957")

    def test_bt0342_4298_2(self):
        self.run_bt_test("bt0342-4298.2")

    def test_bt0280_2426(self):
        self.run_bt_test("bt0280-2426")

    def test_bt0438_4230(self):
        self.run_bt_test("bt0438-4230")

    def test_bt0270_3922(self):
        self.run_bt_test("bt0270-3922")

    def test_bt0021_3859(self):
        self.run_bt_test("bt0021-3859")

    def test_bt0323_3394(self):
        self.run_bt_test("bt0323-3394")

    def test_bt0408_3666(self):
        self.run_bt_test("bt0408-3666")

    def test_bt0429_4043(self):
        self.run_bt_test("bt0429-4043")

    def test_bt0198_546(self):
        self.run_bt_test("bt0198-546")

    def test_bt0312_3818(self):
        self.run_bt_test("bt0312-3818")

    def test_bt0348_4121(self):
        self.run_bt_test("bt0348-4121")

    def test_bt0153_3078(self):
        self.run_bt_test("bt0153-3078")

    def test_bt0031_1217(self):
        self.run_bt_test("bt0031-1217")

    def test_bt0184_4187(self):
        self.run_bt_test("bt0184-4187")

    def test_bt0055_3469_4(self):
        self.run_bt_test("bt0055-3469.4")

    def test_bt0257_3855_1(self):
        self.run_bt_test("bt0257-3855.1")

    def test_bt0242_3804(self):
        self.run_bt_test("bt0242-3804")

    def test_bt0077_441(self):
        self.run_bt_test("bt0077-441")

    def test_bt0011_4163(self):
        self.run_bt_test("bt0011-4163")

    def test_bt0270_3921(self):
        self.run_bt_test("bt0270-3921")

    def test_bt0376_4266(self):
        self.run_bt_test("bt0376-4266")

    def test_bt0036_3571(self):
        self.run_bt_test("bt0036-3571")

    def test_bt0352_4297_1(self):
        self.run_bt_test("bt0352-4297.1")

    def test_bt0199_3639(self):
        self.run_bt_test("bt0199-3639")

    def test_bt0143_3211(self):
        self.run_bt_test("bt0143-3211")

    def test_bt0020_1610(self):
        self.run_bt_test("bt0020-1610")

    def test_bt0440_4255(self):
        self.run_bt_test("bt0440-4255")

    def test_bt0286_846(self):
        self.run_bt_test("bt0286-846")

    def test_bt0337_3543(self):
        self.run_bt_test("bt0337-3543")

    def test_bt0416_4269(self):
        self.run_bt_test("bt0416-4269")

    def test_bt0195_3744(self):
        self.run_bt_test("bt0195-3744")

    def test_bt0334_3582(self):
        self.run_bt_test("bt0334-3582")

    def test_bt0327_3585(self):
        self.run_bt_test("bt0327-3585")

    def test_bt0384_4048(self):
        self.run_bt_test("bt0384-4048")

    def test_bt0056_2685(self):
        self.run_bt_test("bt0056-2685")

    def test_bt0337_4117(self):
        self.run_bt_test("bt0337-4117")

    def test_bt0405_3633(self):
        self.run_bt_test("bt0405-3633")

    def test_bt0439_4270(self):
        self.run_bt_test("bt0439-4270")

    def test_bt0332_3924(self):
        self.run_bt_test("bt0332-3924")

    def test_bt0423_3876(self):
        self.run_bt_test("bt0423-3876")

    def test_bt0351_3138(self):
        self.run_bt_test("bt0351-3138")

    def test_bt0351_4118(self):
        self.run_bt_test("bt0351-4118")

    def test_bt0147_3336(self):
        self.run_bt_test("bt0147-3336")

    def test_bt0067_4013(self):
        self.run_bt_test("bt0067-4013")

    def test_bt0063_3938(self):
        self.run_bt_test("bt0063-3938")

    def test_bt0166_3560(self):
        self.run_bt_test("bt0166-3560")

    def test_bt0156_3659(self):
        self.run_bt_test("bt0156-3659")

    def test_bt0372_3657(self):
        self.run_bt_test("bt0372-3657")

    def test_bt0012_4164_2(self):
        self.run_bt_test("bt0012-4164.2")

    def test_bt0359_3668(self):
        self.run_bt_test("bt0359-3668")

    def test_bt0385_3220(self):
        self.run_bt_test("bt0385-3220")

    def test_bt0403_3595(self):
        self.run_bt_test("bt0403-3595")

    def test_bt0231_1871_4(self):
        self.run_bt_test("bt0231-1871.4")

    def test_bt0003_1196(self):
        self.run_bt_test("bt0003-1196")

    def test_bt0397_3475(self):
        self.run_bt_test("bt0397-3475")

    def test_bt0066_3856(self):
        self.run_bt_test("bt0066-3856")

    def test_bt0423_3824(self):
        self.run_bt_test("bt0423-3824")

    def test_bt0374_3801(self):
        self.run_bt_test("bt0374-3801")

    def test_bt0357_2817(self):
        self.run_bt_test("bt0357-2817")

    def test_bt0281_676(self):
        self.run_bt_test("bt0281-676")

    def test_bt0192_3861(self):
        self.run_bt_test("bt0192-3861")

    def test_bt0218_3579(self):
        self.run_bt_test("bt0218-3579")

    def test_bt0055_3469_2(self):
        self.run_bt_test("bt0055-3469.2")

    def test_bt0349_4276(self):
        self.run_bt_test("bt0349-4276")

    def test_bt0055_3469_1(self):
        self.run_bt_test("bt0055-3469.1")

    def test_bt0420_3794(self):
        self.run_bt_test("bt0420-3794")

    def test_bt0352_2748(self):
        self.run_bt_test("bt0352-2748")

    def test_bt0078_232(self):
        self.run_bt_test("bt0078-232")

    def test_bt0051_3093(self):
        self.run_bt_test("bt0051-3093")

    def test_bt0035_1206(self):
        self.run_bt_test("bt0035-1206")

    def test_bt0070_3850(self):
        self.run_bt_test("bt0070-3850")

    def test_bt0343_2675(self):
        self.run_bt_test("bt0343-2675")

    def test_bt0392_3341(self):
        self.run_bt_test("bt0392-3341")

    def test_bt0068_3564(self):
        self.run_bt_test("bt0068-3564")

    def test_bt0005_3776(self):
        self.run_bt_test("bt0005-3776")

    def test_bt0324_3864(self):
        self.run_bt_test("bt0324-3864")

    def test_bt0002_3673(self):
        self.run_bt_test("bt0002-3673")

    def test_bt0366_2884(self):
        self.run_bt_test("bt0366-2884")

    def test_bt0288_2641(self):
        self.run_bt_test("bt0288-2641")

    def test_bt0210_3411(self):
        self.run_bt_test("bt0210-3411")

    def test_bt0180_2844(self):
        self.run_bt_test("bt0180-2844")

    def test_bt0255_2690_4(self):
        self.run_bt_test("bt0255-2690.4")

    def test_bt0337_3544(self):
        self.run_bt_test("bt0337-3544")

    def test_bt0217_3026(self):
        self.run_bt_test("bt0217-3026")

    def test_bt0065_4171(self):
        self.run_bt_test("bt0065-4171")

    def test_bt0443_4291(self):
        self.run_bt_test("bt0443-4291")

    def test_bt0386_3347(self):
        self.run_bt_test("bt0386-3347")

    def test_bt0104_2853(self):
        self.run_bt_test("bt0104-2853")

    def test_bt0104_2854(self):
        self.run_bt_test("bt0104-2854")

    def test_bt0349_3022(self):
        self.run_bt_test("bt0349-3022")

    def test_bt0427_3943(self):
        self.run_bt_test("bt0427-3943")

    def test_bt0350_3319(self):
        self.run_bt_test("bt0350-3319")

    def test_bt0166_3562(self):
        self.run_bt_test("bt0166-3562")

    def test_bt0318_4289(self):
        self.run_bt_test("bt0318-4289")

    def test_bt0352_2746(self):
        self.run_bt_test("bt0352-2746")

    def test_bt0014_4215(self):
        self.run_bt_test("bt0014-4215")

    def test_bt0190_1386(self):
        self.run_bt_test("bt0190-1386")

    def test_bt0345_2623(self):
        self.run_bt_test("bt0345-2623")

    def test_bt0370_2992(self):
        self.run_bt_test("bt0370-2992")

    def test_bt0156_3660(self):
        self.run_bt_test("bt0156-3660")

    def test_bt0387_3298(self):
        self.run_bt_test("bt0387-3298")

    def test_bt0030_4292(self):
        self.run_bt_test("bt0030-4292")

    def test_bt0388_3311(self):
        self.run_bt_test("bt0388-3311")

    def test_bt0060_4170(self):
        self.run_bt_test("bt0060-4170")

    def test_bt0144_4271(self):
        self.run_bt_test("bt0144-4271")

    def test_bt0188_1382(self):
        self.run_bt_test("bt0188-1382")

    def test_bt0082_2982(self):
        self.run_bt_test("bt0082-2982")

    def test_bt0425_3892(self):
        self.run_bt_test("bt0425-3892")

    def test_bt0254_4224_1(self):
        self.run_bt_test("bt0254-4224.1")

    def test_bt0202_3925(self):
        self.run_bt_test("bt0202-3925")

    def test_bt0333_3583(self):
        self.run_bt_test("bt0333-3583")

    def test_bt0058_2811(self):
        self.run_bt_test("bt0058-2811")

    def test_bt0352_2745(self):
        self.run_bt_test("bt0352-2745")

    def test_bt0034_4082(self):
        self.run_bt_test("bt0034-4082")

    def test_bt0375_3152(self):
        self.run_bt_test("bt0375-3152")

    def test_bt0231_1871_1(self):
        self.run_bt_test("bt0231-1871.1")

    def test_bt0362_3080(self):
        self.run_bt_test("bt0362-3080")

    def test_bt0350_3318(self):
        self.run_bt_test("bt0350-3318")

    def test_bt0337_3901(self):
        self.run_bt_test("bt0337-3901")

    def test_bt0001_3568(self):
        self.run_bt_test("bt0001-3568")

    def test_bt0391_4285(self):
        self.run_bt_test("bt0391-4285")

    def test_bt0434_4149(self):
        self.run_bt_test("bt0434-4149")

    def test_bt0156_3760(self):
        self.run_bt_test("bt0156-3760")

    def test_bt0216_3640(self):
        self.run_bt_test("bt0216-3640")

    def test_bt0330_3931(self):
        self.run_bt_test("bt0330-3931")

    def test_bt0320_3863(self):
        self.run_bt_test("bt0320-3863")

    def test_bt0352_2744(self):
        self.run_bt_test("bt0352-2744")

    def test_bt0348_4120(self):
        self.run_bt_test("bt0348-4120")

    def test_bt0255_2690_2(self):
        self.run_bt_test("bt0255-2690.2")

    def test_bt0024_2218(self):
        self.run_bt_test("bt0024-2218")

    def test_bt0033_1219(self):
        self.run_bt_test("bt0033-1219")

    def test_bt0418_3806(self):
        self.run_bt_test("bt0418-3806")

    def test_bt0208_3256(self):
        self.run_bt_test("bt0208-3256")

    def test_bt0072_4172(self):
        self.run_bt_test("bt0072-4172")

    def test_bt0362_2882(self):
        self.run_bt_test("bt0362-2882")

    def test_bt0374_4081(self):
        self.run_bt_test("bt0374-4081")

    def test_bt0023_3819(self):
        self.run_bt_test("bt0023-3819")

    def test_bt0404_3928(self):
        self.run_bt_test("bt0404-3928")

    def test_bt0260_2032(self):
        self.run_bt_test("bt0260-2032")

    def test_bt0042_4168(self):
        self.run_bt_test("bt0042-4168")

    def test_bt0416_4253(self):
        self.run_bt_test("bt0416-4253")

    def test_bt0173_1376(self):
        self.run_bt_test("bt0173-1376")

    def test_bt0214_1877(self):
        self.run_bt_test("bt0214-1877")

    def test_bt0353_4312(self):
        self.run_bt_test("bt0353-4312")

    def test_bt0436_4247(self):
        self.run_bt_test("bt0436-4247")

    def test_bt0124_3980(self):
        self.run_bt_test("bt0124-3980")

    def test_bt0275_899(self):
        self.run_bt_test("bt0275-899")

    def test_bt0390_3346(self):
        self.run_bt_test("bt0390-3346")

    def test_bt0255_3670(self):
        self.run_bt_test("bt0255-3670")

    def test_bt0298_3335(self):
        self.run_bt_test("bt0298-3335")

    def test_bt0366_2930(self):
        self.run_bt_test("bt0366-2930")

    def test_bt0270_3920(self):
        self.run_bt_test("bt0270-3920")

    def test_bt0241_3580(self):
        self.run_bt_test("bt0241-3580")

    def test_bt0028_3647(self):
        self.run_bt_test("bt0028-3647")

    def test_bt0255_2690_3(self):
        self.run_bt_test("bt0255-2690.3")

    def test_bt0257_3855_4(self):
        self.run_bt_test("bt0257-3855.4")

    def test_bt0373_3577(self):
        self.run_bt_test("bt0373-3577")

    def test_bt0255_2690_1(self):
        self.run_bt_test("bt0255-2690.1")

    def test_bt0364_2870(self):
        self.run_bt_test("bt0364-2870")

    def test_bt0086_4153(self):
        self.run_bt_test("bt0086-4153")

    def test_bt0398_3470(self):
        self.run_bt_test("bt0398-3470")

    def test_bt0086_4152(self):
        self.run_bt_test("bt0086-4152")

    def test_bt0339_3800(self):
        self.run_bt_test("bt0339-3800")

    def test_bt0362_3079(self):
        self.run_bt_test("bt0362-3079")

    def test_bt0340_4250(self):
        self.run_bt_test("bt0340-4250")

    def test_bt0050_2173(self):
        self.run_bt_test("bt0050-2173")

    def test_bt0388_3799(self):
        self.run_bt_test("bt0388-3799")

    def test_bt0348_4122(self):
        self.run_bt_test("bt0348-4122")

    def test_bt0269_3646(self):
        self.run_bt_test("bt0269-3646")

    def test_bt0103_3816(self):
        self.run_bt_test("bt0103-3816")

    def test_bt0158_3361(self):
        self.run_bt_test("bt0158-3361")

    def test_bt0128_4173(self):
        self.run_bt_test("bt0128-4173")

    def test_bt0051_3573(self):
        self.run_bt_test("bt0051-3573")

    def test_bt0348_3840(self):
        self.run_bt_test("bt0348-3840")

    def test_bt0184_3607(self):
        self.run_bt_test("bt0184-3607")

    def test_bt0063_2552(self):
        self.run_bt_test("bt0063-2552")

    def test_bt0330_3929(self):
        self.run_bt_test("bt0330-3929")

    def test_bt0146_3853(self):
        self.run_bt_test("bt0146-3853")

    def test_bt0397_3474(self):
        self.run_bt_test("bt0397-3474")

    def test_bt0257_3855_3(self):
        self.run_bt_test("bt0257-3855.3")

    def test_bt0402_3576(self):
        self.run_bt_test("bt0402-3576")

    def test_bt0259_3814(self):
        self.run_bt_test("bt0259-3814")

    def test_bt0023_3854(self):
        self.run_bt_test("bt0023-3854")

    def test_bt0027_3456(self):
        self.run_bt_test("bt0027-3456")

    def test_bt0055_4169(self):
        self.run_bt_test("bt0055-4169")

    def test_bt0051_3501(self):
        self.run_bt_test("bt0051-3501")

    def test_bt0011_4163_2(self):
        self.run_bt_test("bt0011-4163.2")

    def test_bt0352_4297_2(self):
        self.run_bt_test("bt0352-4297.2")

    def test_bt0012_4164(self):
        self.run_bt_test("bt0012-4164")

    def test_bt0316_4136(self):
        self.run_bt_test("bt0316-4136")

    def test_bt0026_4218(self):
        self.run_bt_test("bt0026-4218")

    def test_bt0234_3381(self):
        self.run_bt_test("bt0234-3381")

    def test_bt0377_4300(self):
        self.run_bt_test("bt0377-4300")

    def test_bt0061_2451(self):
        self.run_bt_test("bt0061-2451")

    def test_bt0313_1587(self):
        self.run_bt_test("bt0313-1587")

    def test_bt0348_4119(self):
        self.run_bt_test("bt0348-4119")

    def test_bt0193_4263(self):
        self.run_bt_test("bt0193-4263")

    def test_bt0378_3188(self):
        self.run_bt_test("bt0378-3188")

    def test_bt0242_3805(self):
        self.run_bt_test("bt0242-3805")

    def test_bt0432_4254(self):
        self.run_bt_test("bt0432-4254")

    def test_bt0189_1410(self):
        self.run_bt_test("bt0189-1410")

    def test_bt0284_3687(self):
        self.run_bt_test("bt0284-3687")

    def test_bt0351_3908(self):
        self.run_bt_test("bt0351-3908")

    def test_bt0029_3674(self):
        self.run_bt_test("bt0029-3674")

    def test_bt0158_3397(self):
        self.run_bt_test("bt0158-3397")

    def test_bt0361_4141(self):
        self.run_bt_test("bt0361-4141")

    def test_bt0225_3862(self):
        self.run_bt_test("bt0225-3862")

    def test_bt0209_3257(self):
        self.run_bt_test("bt0209-3257")

    def test_bt0049_3745(self):
        self.run_bt_test("bt0049-3745")

    def test_bt0358_3553(self):
        self.run_bt_test("bt0358-3553")

    def test_bt0162_4180(self):
        self.run_bt_test("bt0162-4180")

    def test_bt0227_1872(self):
        self.run_bt_test("bt0227-1872")

    def test_bt0226_141(self):
        self.run_bt_test("bt0226-141")

    def test_bt0322_3393(self):
        self.run_bt_test("bt0322-3393")
