Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test #40

Merged
merged 2 commits into from
Nov 5, 2023
Merged
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
14 changes: 9 additions & 5 deletions tests/test_aggify.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,25 +592,29 @@ def test_sequential_matches_combine(self):
def test_get_model_field_invalid_field(self):
aggify = Aggify(BaseModel)
with pytest.raises(InvalidField):
aggify.get_model_field(BaseModel, "tttttt")
aggify.get_model_field(BaseModel, "username")

def test_replace_base_invalid_embedded_field(self):
aggify = Aggify(BaseModel)
with pytest.raises(InvalidEmbeddedField):
aggify._replace_base("name")

def test_aggify_get_item_negative_index(self):
aggify = Aggify(BaseModel)
with pytest.raises(MongoIndexError):
var = Aggify(BaseModel).filter(name=1)[-1:1]
var = aggify.filter(name=1)[-10]

def test_aggify_get_item_slice_step_not_none(self):
aggify = Aggify(BaseModel)
with pytest.raises(MongoIndexError):
var = Aggify(BaseModel).filter(name=1)[slice(1, 3, 2)]
var = aggify.filter(name=1)[slice(1, 3, 2)]

def test_aggify_get_item_slice_start_gte_stop(self):
aggify = Aggify(BaseModel)
with pytest.raises(MongoIndexError):
var = Aggify(BaseModel).filter(name=1)[slice(3, 1)]
var = aggify.filter(name=1)[slice(3, 1)]

def test_aggify_get_item_slice_negative_start(self):
aggify = Aggify(BaseModel)
with pytest.raises(MongoIndexError):
var = Aggify(BaseModel).filter(name=1)[slice(-5, -1)]
var = aggify.filter(name=1)[slice(-5, -1)]
Loading