Beispiel #1
0
def test_count_elements_bad_atomic_nums(rng):
    with pytest.raises(ValueError,
                       match="assumed to represent atomic numbers"):
        count_elements({str(idx): 0 for idx in list(range(*rng))})
Beispiel #2
0
def test_count_elements_by_atomic_nums(df_ptable):
    series_in = pd.Series(1, index=range(1, 119))
    el_cts = count_elements(series_in)
    expected = pd.Series(1, index=df_ptable.index, name="count")

    pd.testing.assert_series_equal(expected, el_cts)
Beispiel #3
0
def steel_elem_counts(steels: pd.Series[Composition]) -> pd.Series[int]:
    return count_elements(steels)
Beispiel #4
0
def test_count_elements(df_ptable, mode, counts):
    series = count_elements(["Fe2 O3"] * 5 + ["Fe4 P4 O16"] * 3, mode=mode)
    expected = pd.Series(counts, index=df_ptable.index, name="count").fillna(0)
    assert series.equals(expected)
Beispiel #5
0
def glass_elem_counts(glasses: pd.Series[Composition]) -> pd.Series[int]:
    return count_elements(glasses)