Skip to content

Commit

Permalink
add unit tests and small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PengLiVectra committed Nov 15, 2023
1 parent ce6ffbf commit 90d7153
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/deltalake-core/src/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::io::{BufRead, BufReader, Cursor};
use std::sync::Arc;
use std::{cmp::max, cmp::Ordering, collections::HashSet};

use bytes::Bytes;
use chrono::{DateTime, Utc};
use futures::StreamExt;
use lazy_static::lazy_static;
Expand Down
12 changes: 10 additions & 2 deletions python/tests/test_table_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from packaging import version

from deltalake._util import encode_partition_value
from deltalake.exceptions import DeltaProtocolError
from deltalake.exceptions import DeltaError, DeltaProtocolError
from deltalake.table import ProtocolVersions
from deltalake.writer import write_deltalake

Expand Down Expand Up @@ -497,12 +497,20 @@ def test_writer_fails_on_protocol():

@pytest.mark.parametrize("version, expected", [(2, (5, 3))])
def test_peek_next_commit(version, expected):
table_path = "../rust/tests/data/simple_table"
table_path = "../crates/deltalake-core/tests/data/simple_table"
dt = DeltaTable(table_path)
actions, current_version = dt.peek_next_commit(version=version)
assert (len(actions), current_version) == expected


def test_delta_log_not_found():
table_path = "../crates/deltalake-core/tests/data/simple_table"
dt = DeltaTable(table_path)
with pytest.raises(DeltaError) as e:
_, _ = dt.peek_next_commit(version=-2)
assert f"Delta log not found for table version:" in str(e)


class ExcPassThroughThread(Thread):
"""Wrapper around `threading.Thread` that propagates exceptions."""

Expand Down

0 comments on commit 90d7153

Please sign in to comment.