def test_majorAndMinor_allMinorsLumpedInTogether(self):
        s = "lineage4.1.2.3.4.5"

        actual = Lineage.from_str(s)
        expected = Lineage(major="4", minor="1.2.3.4.5")

        assert actual == expected
    def test_onlyMajor_minorIsNone(self):
        s = "lineage4"

        actual = Lineage.from_str(s).minor
        expected = ()

        assert actual == expected
    def test_withPrefixLineage_ignoresPrefix(self):
        s = "lineageBovis"

        actual = Lineage.from_str(s)
        expected = Lineage(major="Bovis")

        assert actual == expected
    def test_panelVariantAltIsNotVariantRef_returnsFalse(self, mock_variant):
        pos = 1692141
        index = {
            pos: PanelVariant(Lineage.from_str("4.10"), position=pos, ref="C", alt="T"),
        }
        classifier = Classifier(index, ref_lineage_position=pos)
        mock_variant.POS = pos
        mock_variant.REF = "A"
        mock_variant.ALT = ["C"]
        mock_variant.FILTER = None

        assert not classifier.is_variant_valid(mock_variant)
    def test_panelVariantAltIsVariantRefForRefLineagePos_returnsIndex(
        self, mock_variant
    ):
        pos = 1692141
        index = {
            pos: PanelVariant(Lineage.from_str("4.10"), position=pos, ref="C", alt="A"),
        }
        classifier = Classifier(index, ref_lineage_position=pos)
        mock_variant.POS = pos
        mock_variant.REF = "A"
        mock_variant.ALT = ["C"]
        mock_variant.genotypes = [[0, 0, False], [1, 1, False]]
        mock_variant.format.return_value = ["PASS", "PASS"]

        actual = classifier.samples_with_lineage_variant(mock_variant)
        expected = [0]

        assert actual == expected
 def test_emptyString_raisesError(self):
     s = ""
     with pytest.raises(InvalidLineageString):
         Lineage.from_str(s)