Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
akoumjian committed Sep 18, 2024
1 parent cfa6b63 commit 9443bcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion quivr/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def __get__(self, obj: Optional[tables.Table], objtype: type) -> Union[Self, T]:
# We don't validate the subtable. If the parent table were validated,
# then the subtable would have been validated as part of that process.
# If the parent table is intentionally not validated, then we don't
# want to validate the subtable either as it will throw an error
# want to validate the subtable either as it will throw an error
# when accessing the subtable as a column (e.g. during concatenation).
return self.table_type.from_pyarrow(subtable, permit_nulls=self.nullable, validate=False)

Expand Down
9 changes: 7 additions & 2 deletions test/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,18 @@ def test_concatenate_no_validate():

class OtherTable(qv.Table):
y = qv.Int64Column(validator=qv.le(0))

class ValidationTable(qv.Table):
x = qv.Int64Column(validator=qv.ge(0))
subtable = OtherTable.as_column(nullable=True)

valid = ValidationTable.from_kwargs(x=[1], subtable=OtherTable.from_kwargs(y=[-1], validate=False), validate=False)
valid = ValidationTable.from_kwargs(
x=[1], subtable=OtherTable.from_kwargs(y=[-1], validate=False), validate=False
)
invalid_x = ValidationTable.from_kwargs(x=[-1], subtable=[None], validate=False)
invalid_subtable = ValidationTable.from_kwargs(x=[1], subtable=OtherTable.from_kwargs(y=[1], validate=False), validate=False)
invalid_subtable = ValidationTable.from_kwargs(
x=[1], subtable=OtherTable.from_kwargs(y=[1], validate=False), validate=False
)

with pytest.raises(qv.ValidationError, match="Column x failed validation"):
qv.concatenate([invalid_x, valid])
Expand Down

0 comments on commit 9443bcb

Please sign in to comment.