Пример #1
0
    def test_sanitise_label_group(self):
        for label_in, label_out in (
            ("X", "X"),
            ("X 1", "X 1"),
            ("X @", "X "),
            ("X@", "X"),
            ("X@@@", "X"),
            ("HEX", "HEX"),
            ("HE@X", "HE@X"),
            ("HE@X 1", "HE@X 1"),
            ("@", None),
            ("@X", None),
            ("@HEX", None),
            (r"X$\mid$Y", r"X$\mid$Y"),
            (r"X$\mid$Y$\mid$Z", r"X$\mid$Y$\mid$Z"),
            (r"@X$\mid$Y$\mid$Z", r"Y$\mid$Z"),
            (r"X$\mid$@Y$\mid$Z", r"X$\mid$Z"),
            (r"X$\mid$@Z", r"X"),
            (r"X@$\mid$Y", r"X$\mid$Y"),
            (r"X@$\mid$Y@@", r"X$\mid$Y"),
            (r"@X@$\mid$Y@", r"Y"),
            (r"X@$\mid$@Y", r"X"),
            (r"@X@$\mid$@Y", None),
        ):

            self.assertEqual(SBSPlotter._sanitise_label_group(label_in),
                             label_out)
Пример #2
0
    def test_sanitise_label_group(self):
        for label_in, label_out in (('X', 'X'), ('X 1', 'X 1'), ('X @', 'X '),
                                    ('X@', 'X'), ('X@@@', 'X'), ('HEX', 'HEX'),
                                    ('HE@X', 'HE@X'), ('HE@X 1', 'HE@X 1'),
                                    ('@', None), ('@X', None), ('@HEX', None),
                                    (r'X$\mid$Y',
                                     r'X$\mid$Y'), (r'X$\mid$Y$\mid$Z',
                                                    r'X$\mid$Y$\mid$Z'),
                                    (r'@X$\mid$Y$\mid$Z',
                                     r'Y$\mid$Z'), (r'X$\mid$@Y$\mid$Z',
                                                    r'X$\mid$Z'),
                                    (r'X$\mid$@Z',
                                     r'X'), (r'X@$\mid$Y',
                                             r'X$\mid$Y'), (r'X@$\mid$Y@@',
                                                            r'X$\mid$Y'),
                                    (r'@X@$\mid$Y@',
                                     r'Y'), (r'X@$\mid$@Y',
                                             r'X'), (r'@X@$\mid$@Y', None)):

            self.assertEqual(SBSPlotter._sanitise_label_group(label_in),
                             label_out)