コード例 #1
0
def test_to_pdgid():
    gid = Geant3ID(8)
    assert gid.to_pdgid() == 211
    assert gid.to_pdgid() == PDGID(211)
コード例 #2
0
def test_from_pdgid_non_matching():
    with pytest.raises(MatchingIDNotFound):
        gid = Geant3ID.from_pdgid(55)
コード例 #3
0
def test_from_pdgid():
    assert Geant3ID.from_pdgid(211) == 8

    assert Geant3ID.from_pdgid(PDGID(211)) == 8
    assert Geant3ID.from_pdgid(PDGID(211)) == Geant3ID(8)
コード例 #4
0
def test_class_inversion():
    assert -Geant3ID(1) == ~Geant3ID(1)
コード例 #5
0
def test_class_return_type():
    assert isinstance(-Geant3ID(3), Geant3ID)
    assert isinstance(~Geant3ID(3), Geant3ID)
コード例 #6
0
def test_class_string_representations():
    pid = Geant3ID(1)
    assert pid == 1
    assert pid.__str__() == "<Geant3ID: 1>"