Issue: Disabling coercion for Func does not work
Author: danygielow
State: closed
Created: 2016-09-20 14:52:20

``` python
class Foo(Model):
    id = IntegerField()

Foo.create_table()
Foo.create(id=1)
Foo.create(id=2)

print list(Foo.select(fn.GROUP_CONCAT(Foo.id).coerce(False)))

>>ValueError: invalid literal for int() with base 10: '1,2'
```

peewee version 2.8.3


What database engine are you using?


Just committed a test. I was not able to replicate this issue:

``` diff
commit 39531323fd4d24cc4fc0c7039ef83936ec908bc7
Author: Charles Leifer <charles.leifer@propylon.pri>
Date:   Tue Sep 20 17:31:09 2016 -0500

    Add test related to #1073. Unable to replicate.

diff --git a/playhouse/tests/test_models.py b/playhouse/tests/test_models.py
index fc0884b..80a7eac 100644
--- a/playhouse/tests/test_models.py
+++ b/playhouse/tests/test_models.py
@@ -2280,3 +2280,31 @@ class TestDefaultDirtyBehavior(PeeweeTestCase):

         dm3_db = DM.get(DM.id == dm3.id)
         self.assertEqual(dm3_db.field, 4)
+
+
+class TestFunctionCoerceRegression(PeeweeTestCase):
+    def test_function_coerce(self):
+        class M1(Model):
+            data = IntegerField()
+            class Meta:
+                database = in_memory_db
+
+        class M2(Model):
+            id = IntegerField()
+            class Meta:
+                database = in_memory_db
+
+        in_memory_db.create_tables([M1, M2])
+
+        for i in range(3):
+            M1.create(data=i)
+            M2.create(id=i + 1)
+
+        qm1 = M1.select(fn.GROUP_CONCAT(M1.data).coerce(False).alias('data'))
+        qm2 = M2.select(fn.GROUP_CONCAT(M2.id).coerce(False).alias('ids'))
+
+        m1 = qm1.get()
+        self.assertEqual(m1.data, '0,1,2')
+
+        m2 = qm2.get()
+        self.assertEqual(m2.ids, '1,2,3')
```


Hi, I used SqliteDatabase(':memory:'), but it is the same for MySQLDatabase as well.

I ran your test and it gives me the same error as before:

``` python
======================================================================
ERROR: test_function_coerce (bla.TestFunctionCoerceRegression)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/d.gielow/projects-python/cronjobs/bla.py", line 31, in test_function_coerce
    m1 = qm1.get()
  File "/data/d.gielow/projects-python/cronjobs/env/local/lib/python2.7/site-packages/peewee.py", line 3090, in get
    return next(clone.execute())
  File "playhouse/_speedups.pyx", line 216, in playhouse._speedups._QueryResultWrapper.__next__ (playhouse/_speedups.c:4430)
  File "playhouse/_speedups.pyx", line 200, in playhouse._speedups._QueryResultWrapper.iterate (playhouse/_speedups.c:4159)
  File "playhouse/_speedups.pyx", line 275, in playhouse._speedups._ModelQueryResultWrapper.process_row (playhouse/_speedups.c:5466)
  File "playhouse/_speedups.pyx", line 263, in playhouse._speedups._DictQueryResultWrapper._make_dict (playhouse/_speedups.c:5306)
  File "/data/d.gielow/projects-python/cronjobs/env/local/lib/python2.7/site-packages/peewee.py", line 962, in python_value
    return value if value is None else self.coerce(value)
ValueError: invalid literal for int() with base 10: '0,1,2'
```


Fixed it for real this time, thanks for the traceback.