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

Filter chain failing tests #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions neo4django/tests/nodequeryset_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,46 @@ def test_filter_isnull():
eq_(len(q3), 1)
eq_(q3[0], nameless_person)

@with_setup(None,teardown)
def test_filter_chain_istartswith():
class MyGuy(models.NodeModel):
name = models.StringProperty(indexed=True)
age = models.IntegerProperty(indexed=True)

MyGuy.objects.create(name='Alex')
MyGuy.objects.create(name='Albert')
MyGuy.objects.create(name='Alicia')
AL_A = list(MyGuy.objects.filter(name__istartswith='Al').filter(name__istartswith='A'))
A_AL = list(MyGuy.objects.filter(name__istartswith='A').filter(name__istartswith='Al'))
eq_(len(AL_A),3)
eq_(len(A_AL),3)

@with_setup(None,teardown)
def test_filter_chain_icontains():
class MyGuy(models.NodeModel):
name = models.StringProperty(indexed=True)
age = models.IntegerProperty(indexed=True)

MyGuy.objects.create(name='Alex')
MyGuy.objects.create(name='Albert')
MyGuy.objects.create(name='Alicia')
AL_E = list(MyGuy.objects.filter(name__istartswith='Al').filter(name__icontains='e'))
E_AL = list(MyGuy.objects.filter(name__icontains='e').filter(name__istartswith='Al'))
eq_(len(AL_E),2) # Albert Alex
eq_(len(E_AL),2)

@with_setup(None,teardown)
def test_filter_chain_contains_istartswith():
class MyGuy(models.NodeModel):
name = models.StringProperty(indexed=True)
age = models.IntegerProperty(indexed=True)

MyGuy.objects.create(name='Alex')
MyGuy.objects.create(name='Albert')
MyGuy.objects.create(name='Alicia')
E_AL = list(MyGuy.objects.filter(name__contains='e').filter(name__istartswith='Al'))
eq_(len(E_AL),2) # Albert Alex

@with_setup(None, teardown)
def test_exclude_exact():
pass
Expand Down