Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Corrige l'opérateur __le

  • Loading branch information...
commit 17e8a13ff72697a1a60307e7b727df751bfb97cf 1 parent 470e8d0
Guillaume Camera authored
View
7 Changelog.txt
@@ -1,3 +1,10 @@
+0.3.4
+ * Corrige les opérateur __le et __ge
+
+0.3.3 released on 2013-02-14
+ * Try except autour de la récupération du long_description dans le
+ setup.py
+
0.3.2 released on 2013-02-14
* Ajout d'un MANIFEST dans le packaging
* Correction du topic dans le setup.py
View
7 setup.py
@@ -3,13 +3,18 @@
import sqla_helpers
+try:
+ long_description = open('doc/sqla_helpers.rst').read(),
+except IOError:
+ long_description = ''
+
setup(
name='sqla_helpers',
version=sqla_helpers.__version__,
author='Guillaume Camera',
author_email='camera.g@gmail.com',
description="Fournit quelques méthodes de récupération d'objet en base autour d'SQLAlchemy",
- long_description=open('doc/sqla_helpers.rst').read(),
+ long_description=long_description,
url="https://github.com/moumoutte/sqla_helpers/",
packages=find_packages(),
classifiers=[
View
2  sqla_helpers/__init__.py
@@ -1,2 +1,2 @@
#-*- coding: utf-8 -*-
-__version__ = "0.3.2"
+__version__ = "0.3.4"
View
4 sqla_helpers/process.py
@@ -2,9 +2,9 @@
operators = {
'not': '__ne__',
'lt': '__lt__',
- 'le': '__lte__',
+ 'le': '__le__',
'gt': '__gt__',
- 'gte': '__gte__',
+ 'ge': '__ge__',
'in': 'in_',
'like': 'like',
'ilike': 'ilike',
View
35 sqla_helpers/tests/test_process_params.py
@@ -11,10 +11,45 @@ def test_simple():
assert len(res) == 1
assert str(Treatment.name == 0) == str(res[0])
+
def test_multiple_key():
res = process_params(Treatment, [], id=0, name='toto')
assert len(res) == 2
+
+def test_not_operator():
+ res = process_params(Treatment, [], id__not=0)
+ assert len(res) == 1
+ assert str(Treatment.id != 0) == str(res[0])
+
+
+def test_lt_operator():
+ res = process_params(Treatment, [], id__lt=0)
+ assert len(res) == 1
+ assert str(Treatment.id < 0) == str(res[0])
+
+
+def test_le_operator():
+ res = process_params(Treatment, [], id__le=0)
+ assert len(res) == 1
+ assert str(Treatment.id <= 0) == str(res[0])
+
+def test_gt_operator():
+ res = process_params(Treatment, [], id__gt=0)
+ assert len(res) == 1
+ assert str(Treatment.id > 0) == str(res[0])
+
+def test_ge_operator():
+ res = process_params(Treatment, [], id__ge=0)
+ assert len(res) == 1
+ assert str(Treatment.id >= 0) == str(res[0])
+
+def test_in_operator():
+ res = process_params(Treatment, [], id__in=[0])
+ assert len(res) == 1
+ assert str(Treatment.id.in_([0])) == str(res[0])
+
+
@raises(AttributeError)
def test_unknow_attr():
process_params(Treatment, [], test='toto')
Please sign in to comment.
Something went wrong with that request. Please try again.