Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_html_name(pid, html_name):
particle = Particle.from_pdgid(pid)
assert particle.html_name == html_namedef test_int_compare():
assert Particle.from_pdgid(211) > 0
assert Particle.from_pdgid(-211) < 0
assert Particle.from_pdgid(211) >= 0
assert Particle.from_pdgid(-211) <= 0
assert 0 < Particle.from_pdgid(211)
assert 0 > Particle.from_pdgid(-211)
assert 0 <= Particle.from_pdgid(211)
assert 0 >= Particle.from_pdgid(-211)def test_pdg_convert():
p = Particle.from_pdgid(211)
assert isinstance(p.pdgid, PDGID)
assert int(p) == 211
assert PDGID(p) == 211def test_is_name_barred(pid, has_bar):
particle = Particle.from_pdgid(pid)
assert particle.is_name_barred == has_bardef test_pdg():
assert Particle.from_pdgid(211).pdgid == 211
with pytest.raises(InvalidParticle):
Particle.from_pdgid(0)def test_spin_type(pid, stype):
particle = Particle.from_pdgid(pid)
assert particle.spin_type == stypedef test_describe(pid, description):
particle = Particle.from_pdgid(pid)
assert description in particle.describe()def test_basic_props():
pi = Particle.from_pdgid(211)
assert pi.pdg_name == "pi"
assert pi.pdgid == 211
assert pi.three_charge == Charge.p
assert pi.charge == 1def test_default_table_loading_bis():
Particle.all()
p = Particle.from_pdgid(211)
assert p.table_loaded() is True
assert p.table_names() == ("particle2019.csv", "nuclei2020.csv")