Main Page
Namespaces
Classes
Files
File List
src
jsk_data
tests
test_util.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
import
datetime
5
6
from
freezegun
import
freeze_time
7
from
nose.tools
import
assert_equal
8
9
from
jsk_data.util
import
filename_with_timestamp
10
11
12
@freeze_time(
'1999-01-01 23:59:59'
)
13
def
test_filename_with_timestamp
():
14
stamp = datetime.datetime.now().strftime(
'%Y-%m-%d-%H-%M-%S'
)
15
# originally no stamp
16
filename =
'/tmp/pr2-test-1.bag'
17
expected =
'/tmp/{}_pr2-test-1.bag'
.format(stamp)
18
assert_equal(expected,
filename_with_timestamp
(filename))
19
# stamped
20
filename =
'/tmp/2015-01-01-23-59-59-pr2-test-999.bag'
21
assert_equal(filename,
filename_with_timestamp
(filename))
22
# wrong formated stamp
23
filename =
'/tmp/2015-01-01_23-59-59-pr2-test-999.bag'
24
expected =
'/tmp/{}_2015-01-01_23-59-59-pr2-test-999.bag'
.format(stamp)
25
assert_equal(expected,
filename_with_timestamp
(filename))
jsk_data.util.filename_with_timestamp
def filename_with_timestamp(filename, sep=None)
Definition:
util.py:8
jsk_data.util
Definition:
util.py:1
test_util.test_filename_with_timestamp
def test_filename_with_timestamp()
Definition:
test_util.py:13
jsk_data
Author(s):
autogenerated on Tue Feb 6 2018 03:45:36