Going somewhere before going to the gym

This commit is contained in:
didier committed 2024-11-15 13:33:14 -05:00
1 parent f5b8e24e01
commit 236dd82871
4 files changed
+103 -63

No files matched your search

+49 -2
View File
@@ -71,7 +71,25 @@ def test_start(tmp_dir: Path):
}
assert expt == list_tables(conn)
#
def test_restart(tmp_dir: Path):
with make_conn(tmp_dir) as conn:
dumper = SQLiteDataDumper(conn)
dumper.start(Path('foo/bar.MOV'), 'aaabbb')
with make_conn(tmp_dir) as conn:
dumper = SQLiteDataDumper(conn)
dumper.start(Path('foo/bar.MOV'), 'aaabbb')
with make_conn(tmp_dir) as conn:
expt = {
'tracked_detected_object',
'video',
'video_frame'
}
assert expt == list_tables(conn)
def test_write_boxes_simple(tmp_dir: Path, mock_tracked_detected_object: pd.DataFrame):
with make_conn(tmp_dir) as conn:
dumper = SQLiteDataDumper(conn)
@@ -79,4 +97,33 @@ def test_write_boxes_simple(tmp_dir: Path, mock_tracked_detected_object: pd.Data
dumper.write_boxes(mock_tracked_detected_object, 40018, 34)
with make_conn(tmp_dir) as conn:
assert 10 == number_of_items_in_table('tracked_detected_object', conn)
assert 10 == number_of_items_in_table('tracked_detected_object', conn)
def test_write_boxes_multiple_times(tmp_dir: Path, mock_tracked_detected_object: pd.DataFrame):
with make_conn(tmp_dir) as conn:
dumper = SQLiteDataDumper(conn)
dumper.start(Path('/foo/toto.MOV'), 'aabbcc')
dumper.write_boxes(mock_tracked_detected_object, 40018, 34)
with make_conn(tmp_dir) as conn:
dumper = SQLiteDataDumper(conn)
dumper.start(Path('/foo/toto.MOV'), 'aabbcc')
dumper.write_boxes(mock_tracked_detected_object, 40018, 34)
with make_conn(tmp_dir) as conn:
assert 20 == number_of_items_in_table('tracked_detected_object', conn)
def test_write_boxes_with_empty_frame(tmp_dir: Path,
mock_tracked_detected_object: pd.DataFrame):
empty_tracked_detected_object = mock_tracked_detected_object[0:0]
with make_conn(tmp_dir) as conn:
dumper = SQLiteDataDumper(conn)
dumper.start(Path('/foo/toto.MOV'), 'aabbcc')
dumper.write_boxes(empty_tracked_detected_object, 40018, 34)
with make_conn(tmp_dir) as conn:
assert 0 == number_of_items_in_table('tracked_detected_object', conn)
assert 0 == number_of_items_in_table('video_frame', conn)