# Path: duplicity/globals.py



import config
import sys, unittest, time, types
from duplicity import globals
from duplicity import dup_time
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# Duplicity 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 duplicity; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA



config.setup()

class TimeTest:
    def testConversion(self):
        """test timetostring and stringtotime"""
        dup_time.setcurtime()
        assert type(dup_time.curtime) in (types.IntType, types.LongType)
        assert type(dup_time.curtimestr) is types.StringType
        assert (dup_time.cmp(int(dup_time.curtime), dup_time.curtimestr) == 0 or
                dup_time.cmp(int(dup_time.curtime) + 1, dup_time.curtimestr) == 0)
        time.sleep(1.05)
        assert dup_time.cmp(time.time(), dup_time.curtime) == 1
        assert dup_time.cmp(dup_time.timetostring(time.time()), dup_time.curtimestr) == 1

    def testConversion_separator(self):
        """Same as testConversion, but change time Separator"""

# Path: duplicity/globals.py



# Path: testing/dup_timetest.py
import config
import sys, unittest, time, types
from duplicity import globals
from duplicity import dup_time

# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# Duplicity 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 duplicity; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA



config.setup()

class TimeTest:
    def testConversion(self):
        """test timetostring and stringtotime"""
        dup_time.setcurtime()
        assert type(dup_time.curtime) in (types.IntType, types.LongType)
        assert type(dup_time.curtimestr) is types.StringType
        assert (dup_time.cmp(int(dup_time.curtime), dup_time.curtimestr) == 0 or
                dup_time.cmp(int(dup_time.curtime) + 1, dup_time.curtimestr) == 0)
        time.sleep(1.05)
        assert dup_time.cmp(time.time(), dup_time.curtime) == 1
        assert dup_time.cmp(dup_time.timetostring(time.time()), dup_time.curtimestr) == 1

    def testConversion_separator(self):
        """Same as testConversion, but change time Separator"""

        globals.time_separator = "_"