示例#1
0
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff.  If not, see <http://www.gnu.org/licenses/>.


from django.test import TestCase
from eff.utils import overtime_period, period

from unittest import TestSuite, makeSuite
from datetime import date

periodo_siguiente = lambda d1, d2: period(d1, d2, lambda d1, d2: d1 + d2)
periodo_anterior  = lambda d1, d2: period(d1, d2, lambda d1, d2: d1 - d2)

class TestNextPeriod(TestCase):

    # next

    def test_periodo_siguiente_semana(self):
        f_date = date(2008,5,11)
        t_date = date(2008,5,18)
        self.assertEqual(periodo_siguiente(f_date, t_date), (date(2008,5,19), date(2008,5,26)))

    def test_periodo_siguiente_semana_1(self):
        f_date = date(2008,5,25)
        t_date = date(2008,6,1)
        self.assertEqual(periodo_siguiente(f_date, t_date), (date(2008,6,2), date(2008,6,9)))
示例#2
0
#
# You should have received a copy of the GNU General Public License
# along with Eff.  If not, see <http://www.gnu.org/licenses/>.

from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User
from eff.utils import overtime_period, period, load_dump

from unittest import TestSuite, makeSuite
from datetime import date
import time
# change name to be testeable
from eff.views import __aux_mk_time as aux_mk_time

next_period = lambda d1, d2: period(d1, d2, lambda d1, d2: d1 + d2)
previous_period = lambda d1, d2: period(d1, d2, lambda d1, d2: d1 - d2)


class TestNextPeriod(TestCase):

    # next

    def test_next_period_week(self):
        f_date = date(2008, 5, 11)
        t_date = date(2008, 5, 18)
        self.assertEqual(next_period(f_date, t_date),
                         (date(2008, 5, 19), date(2008, 5, 26)))

    def test_next_period_week_1(self):
        f_date = date(2008, 5, 25)
示例#3
0
文件: testUtils.py 项目: bx5974/eff
#
# You should have received a copy of the GNU General Public License
# along with Eff.  If not, see <http://www.gnu.org/licenses/>.

from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User
from eff.utils import overtime_period, period, load_dump

from unittest import TestSuite, makeSuite
from datetime import date
import time
# change name to be testeable
from eff.views import __aux_mk_time as aux_mk_time

next_period = lambda d1, d2: period(d1, d2, lambda d1, d2: d1 + d2)
previous_period = lambda d1, d2: period(d1, d2, lambda d1, d2: d1 - d2)


class TestNextPeriod(TestCase):

    # next

    def test_next_period_week(self):
        f_date = date(2008, 5, 11)
        t_date = date(2008, 5, 18)
        self.assertEqual(next_period(f_date, t_date),
            (date(2008, 5, 19), date(2008, 5, 26)))

    def test_next_period_week_1(self):
        f_date = date(2008, 5, 25)