summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorminimumserious <commande.romain@gmail.com>2013-06-13 10:33:56 +0200
committerRaphaƫl Barrois <raphael.barrois@polytechnique.org>2013-06-20 01:40:14 +0200
commit5137998a856519cd11cd743d6c567497600139e8 (patch)
treeb04394546973a5de5c5695e19806dfa4394f13e3
parent94048a282ed8085df4f6f08931dd1c3804236b76 (diff)
downloadfactory-boy-5137998a856519cd11cd743d6c567497600139e8.tar
factory-boy-5137998a856519cd11cd743d6c567497600139e8.tar.gz
Fixed SQLAlchemy tests on Python32
-rw-r--r--factory/alchemy.py1
-rw-r--r--tests/test_alchemy.py32
2 files changed, 17 insertions, 16 deletions
diff --git a/factory/alchemy.py b/factory/alchemy.py
index 8ede97f..2bfaf81 100644
--- a/factory/alchemy.py
+++ b/factory/alchemy.py
@@ -18,6 +18,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+from __future__ import unicode_literals
from . import base
diff --git a/tests/test_alchemy.py b/tests/test_alchemy.py
index a1d8576..39e94c8 100644
--- a/tests/test_alchemy.py
+++ b/tests/test_alchemy.py
@@ -50,14 +50,14 @@ class StandardFactory(SQLAlchemyModelFactory):
FACTORY_SESSION = models.session
id = factory.Sequence(lambda n: n)
- foo = factory.Sequence(lambda n: u'foo%d' % n)
+ foo = factory.Sequence(lambda n: 'foo%d' % n)
class NonIntegerPkFactory(SQLAlchemyModelFactory):
FACTORY_FOR = models.NonIntegerPk
FACTORY_SESSION = models.session
- id = factory.Sequence(lambda n: u'foo%d' % n)
+ id = factory.Sequence(lambda n: 'foo%d' % n)
@unittest.skipIf(sqlalchemy is None, "SQLalchemy not installed.")
@@ -70,32 +70,32 @@ class SQLAlchemyPkSequenceTestCase(unittest.TestCase):
def test_pk_first(self):
std = StandardFactory.build()
- self.assertEqual(u'foo1', std.foo)
+ self.assertEqual('foo1', std.foo)
def test_pk_many(self):
std1 = StandardFactory.build()
std2 = StandardFactory.build()
- self.assertEqual(u'foo1', std1.foo)
- self.assertEqual(u'foo2', std2.foo)
+ self.assertEqual('foo1', std1.foo)
+ self.assertEqual('foo2', std2.foo)
def test_pk_creation(self):
std1 = StandardFactory.create()
- self.assertEqual(u'foo1', std1.foo)
+ self.assertEqual('foo1', std1.foo)
self.assertEqual(1, std1.id)
StandardFactory.reset_sequence()
std2 = StandardFactory.create()
- self.assertEqual(u'foo2', std2.foo)
+ self.assertEqual('foo2', std2.foo)
self.assertEqual(2, std2.id)
def test_pk_force_value(self):
std1 = StandardFactory.create(id=10)
- self.assertEqual(u'foo1', std1.foo) # sequence was set before pk
+ self.assertEqual('foo1', std1.foo) # sequence was set before pk
self.assertEqual(10, std1.id)
StandardFactory.reset_sequence()
std2 = StandardFactory.create()
- self.assertEqual(u'foo11', std2.foo)
+ self.assertEqual('foo11', std2.foo)
self.assertEqual(11, std2.id)
@@ -108,27 +108,27 @@ class SQLAlchemyNonIntegerPkTestCase(unittest.TestCase):
def test_first(self):
nonint = NonIntegerPkFactory.build()
- self.assertEqual(u'foo1', nonint.id)
+ self.assertEqual('foo1', nonint.id)
def test_many(self):
nonint1 = NonIntegerPkFactory.build()
nonint2 = NonIntegerPkFactory.build()
- self.assertEqual(u'foo1', nonint1.id)
- self.assertEqual(u'foo2', nonint2.id)
+ self.assertEqual('foo1', nonint1.id)
+ self.assertEqual('foo2', nonint2.id)
def test_creation(self):
nonint1 = NonIntegerPkFactory.create()
- self.assertEqual(u'foo1', nonint1.id)
+ self.assertEqual('foo1', nonint1.id)
NonIntegerPkFactory.reset_sequence()
nonint2 = NonIntegerPkFactory.build()
- self.assertEqual(u'foo1', nonint2.id)
+ self.assertEqual('foo1', nonint2.id)
def test_force_pk(self):
nonint1 = NonIntegerPkFactory.create(id='foo10')
- self.assertEqual(u'foo10', nonint1.id)
+ self.assertEqual('foo10', nonint1.id)
NonIntegerPkFactory.reset_sequence()
nonint2 = NonIntegerPkFactory.create()
- self.assertEqual(u'foo1', nonint2.id)
+ self.assertEqual('foo1', nonint2.id)