Go to the documentation of this file.00001
00002
00003
00004 import datetime
00005
00006 from freezegun import freeze_time
00007 from nose.tools import assert_equal
00008
00009 from jsk_data.util import filename_with_timestamp
00010
00011
00012 @freeze_time('1999-01-01 23:59:59')
00013 def test_filename_with_timestamp():
00014 stamp = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
00015
00016 filename = '/tmp/pr2-test-1.bag'
00017 expected = '/tmp/{}_pr2-test-1.bag'.format(stamp)
00018 assert_equal(expected, filename_with_timestamp(filename))
00019
00020 filename = '/tmp/2015-01-01-23-59-59-pr2-test-999.bag'
00021 assert_equal(filename, filename_with_timestamp(filename))
00022
00023 filename = '/tmp/2015-01-01_23-59-59-pr2-test-999.bag'
00024 expected = '/tmp/{}_2015-01-01_23-59-59-pr2-test-999.bag'.format(stamp)
00025 assert_equal(expected, filename_with_timestamp(filename))