コード例 #1
0
def test_statistic_can_be_created_from_list():
    data = [1, 2, 3]
    st = Statistic(data)
    assert len(st) == 3
    assert not st.empty
    assert st.as_list() == [1, 2, 3]
    assert st.as_tuple() == tuple(data)
    assert st.as_list() is not data  # check that data was copied
コード例 #2
0
def test_statistic_is_initially_empty():
    st = Statistic()
    assert len(st) == 0
    assert st.empty
    assert st.as_list() == []
    assert st.as_tuple() == ()