Skip to content

Commit

Permalink
Fixed between operator
Browse files Browse the repository at this point in the history
  • Loading branch information
matllubos committed Dec 1, 2021
1 parent fc97df9 commit 0443c8a
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
relative_files = True
51 changes: 51 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Django CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7, 3.8, 3.9]

services:
dynamodb:
image: amazon/dynamodb-local
ports:
- 8000:8000

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
pip install -e .
- name: Run Tests
run: |
flake8 --config .config/flake8 pydjamodb
coverage run tests/manage.py test tests
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: Unit Test

coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Prolog

`pydjamodb` library is Django connector to the AWS DynamoDB. As a base is used `PynamoDB` library which models is transformed into `Django` model structure with the querysets and managers.

[![Coverage Status](https://coveralls.io/repos/github/druids/pydjamodb/badge.svg?branch=master)](https://coveralls.io/github/druids/pydjamodb?branch=master)

Installation
------------

Expand Down
2 changes: 2 additions & 0 deletions pydjamodb/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def filter(self, **kwargs):

obj._pre_filter(field, field_name, operator, value)
obj._filter = obj._get_filter(field, operator, value)
if operator == 'between' and value[0] > value[1]:
return self.none()
return obj

def get(self, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
https://github.com/druids/pynamodb/tarball/AddTagsSupport#egg=pynamodb
django-germanium==2.2.3
flake8
coverage
coveralls
1 change: 1 addition & 0 deletions tests/test_app/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def test_queryset_filter_should_return_filtered_items(self):
qs = TestDynamoModel.objects_string_number.set_hash_key('test')
assert_equal(list(qs.filter(number=5)), [instances[5]])
assert_equal(list(qs.filter(number__between=(2, 4))), instances[2:5])
assert_equal(list(qs.filter(number__between=(4, 2))), [])
assert_equal(list(qs.filter(number__gt=4)), instances[5:])
assert_equal(list(qs.filter(number__lte=4)), instances[:5])

Expand Down

0 comments on commit 0443c8a

Please sign in to comment.