Skip to content

Commit 2ea5d98

Browse files
committed
Correct index testing
Add some tests related to the `dir()` method.
1 parent bdb16e6 commit 2ea5d98

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

tests/test_mass_table.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ def test_empty_filter(empty_frame):
3838
assert len(empty_frame._filters) == 0
3939

4040

41+
def test_unique_and_sorted_dir(empty_frame):
42+
output = dir(empty_frame)
43+
assert output == sorted(output)
44+
assert len(output) == len(set(output))
45+
46+
47+
def test_dir_includes_class_attributes(empty_frame):
48+
output = dir(empty_frame)
49+
50+
assert "_parse_files" in output
51+
assert "get" in output
52+
53+
54+
def test_dir_includes_pandas_attributes(empty_frame):
55+
output = dir(empty_frame)
56+
57+
assert "describe" in output
58+
assert "head" in output
59+
60+
4161
def test_manually_populated_filter():
4262
cols = ["ManualParameter"]
4363
test_frame = pd.DataFrame.from_dict(data=dict.fromkeys(cols, [0]))
@@ -66,9 +86,9 @@ def test_auto_populated_filter():
6686
def test_getter_on_index():
6787
cols = ["Mass", "Error", "Param", "RandomLongerString"]
6888
test_frame = pd.DataFrame.from_dict(data=dict.fromkeys(cols, [0]))
89+
test_frame.set_index("Param")
6990

7091
m_df = MassTable(df=test_frame)
71-
m_df.set_index("Param")
7292
m_df = m_df.get_Param(0).df
7393

7494
expected = pd.DataFrame(

0 commit comments

Comments
 (0)