# Path: examples/pyramid_tut/pyramid_tut/models.py
# class User(Base):
# class Address(Base):
#     def __unicode__(self):
#     def __repr__(self):
#     def __unicode__(self):
#     def __repr__(self):


import os
import sys
import unittest
import transaction
import webtest
from datetime import date
from ..models import Base, User, DBSession, Address
        from .. import main
        settings = {
            "sqlalchemy.url": "sqlite://",
            "auth.secret": "seekrit",
        }
        app = main({}, **settings)
        cls.testapp = webtest.TestApp(app)
        cls.dbsession = DBSession()
        cls.engine = cls.dbsession.bind
        Base.metadata.create_all(bind=cls.engine)

        for i in range(30):
            with transaction.manager:
                address = Address(description="Address#2" + str(i).rjust(2, "0"))

                cls.dbsession.add(address)

                user = User(
                    name="User#1" + str(i).rjust(2, "0"),
                    birthday=date(1980 + i % 8, i % 12 + 1, i % 10 + 1),
                )

                user.address = address

                cls.dbsession.add(user)

    @classmethod
    def tearDownClass(cls):
        Base.metadata.drop_all(bind=cls.engine)

    def test_nr_of_users_in_db(self):

# Path: examples/pyramid_tut/pyramid_tut/models.py
# class User(Base):
# class Address(Base):
#     def __unicode__(self):
#     def __repr__(self):
#     def __unicode__(self):
#     def __repr__(self):


# Path: examples/pyramid_tut/pyramid_tut/tests/test_pyramid_example.py
import os
import sys
import unittest
import transaction
import webtest
from datetime import date
from ..models import Base, User, DBSession, Address
        from .. import main

        settings = {
            "sqlalchemy.url": "sqlite://",
            "auth.secret": "seekrit",
        }
        app = main({}, **settings)
        cls.testapp = webtest.TestApp(app)
        cls.dbsession = DBSession()
        cls.engine = cls.dbsession.bind
        Base.metadata.create_all(bind=cls.engine)

        for i in range(30):
            with transaction.manager:
                address = Address(description="Address#2" + str(i).rjust(2, "0"))

                cls.dbsession.add(address)

                user = User(
                    name="User#1" + str(i).rjust(2, "0"),
                    birthday=date(1980 + i % 8, i % 12 + 1, i % 10 + 1),
                )

                user.address = address

                cls.dbsession.add(user)

    @classmethod
    def tearDownClass(cls):
        Base.metadata.drop_all(bind=cls.engine)

    def test_nr_of_users_in_db(self):

        nr_of_users_in_db = self.dbsession.query(User).count()