Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/.env.versions
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
HATCH_VERSION="1.14.2"

# Full pip install command
HATCH_INSTALL_CMD="pip install hatch==${HATCH_VERSION}"
# Pin virtualenv<21 to work around https://github.com/pypa/hatch/issues/2193
HATCH_INSTALL_CMD="pip install hatch==${HATCH_VERSION} virtualenv<21"
22 changes: 22 additions & 0 deletions python/tests/tsdf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,28 @@ def test_show_k_gt_n(self):
sys.stdout = captured_output
self.assertRaises(ValueError, init_tsdf.show, 5, 10)

def test_show_k_2(self):
"""Verify that k limits the number of rows shown per series."""
init_tsdf = self.get_test_df_builder("init").as_tsdf()

captured_output = StringIO()
sys.stdout = captured_output
init_tsdf.show(n=20, k=2)
self.assertEqual(
captured_output.getvalue(),
(
"+------+-------------------+--------+\n"
"|symbol| event_ts|trade_pr|\n"
"+------+-------------------+--------+\n"
"| S1|2020-09-01 00:02:10| 361.1|\n"
"| S1|2020-09-01 00:19:12| 362.1|\n"
"| S2|2020-09-01 00:02:10| 761.1|\n"
"| S2|2020-09-01 00:20:42| 762.33|\n"
"+------+-------------------+--------+\n"
"\n"
),
)

def test_show_truncate_false(self):
init_tsdf = self.get_test_df_builder("init").as_tsdf()

Expand Down
5 changes: 5 additions & 0 deletions python/tests/unit_test_data/tsdf_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@
"$ref": "#/__SharedData/temp_slice_init_data"
}
},
"test_show_k_2": {
"init": {
"$ref": "#/__SharedData/temp_slice_init_data"
}
},
"test_show_truncate_false": {
"init": {
"$ref": "#/__SharedData/temp_slice_init_data"
Expand Down