4 new revisions:
Revision: dc7ce2947b7c
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 08:29:12 2014 UTC
Log: html formatting: explicit utests for newlines in custom link
titles
http://code.google.com/p/robotframework/source/detail?r=dc7ce2947b7c
Revision: de53c4ed0ef1
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 08:30:57 2014 UTC
Log: AUTHORS: Added Michael Walle who implemented Telnet.Write Control
Char...
http://code.google.com/p/robotframework/source/detail?r=de53c4ed0ef1
Revision: a9d8dff72f01
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 08:50:24 2014 UTC
Log: DateTime: Specify custom timestamp format w/o 'timestamp:'
prefix....
http://code.google.com/p/robotframework/source/detail?r=a9d8dff72f01
Revision: 4bd2a80b4e26
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 09:22:55 2014 UTC
Log: DateTime: More tests and one fix for handling millis...
http://code.google.com/p/robotframework/source/detail?r=4bd2a80b4e26
==============================================================================
Revision: dc7ce2947b7c
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 08:29:12 2014 UTC
Log: html formatting: explicit utests for newlines in custom link
titles
http://code.google.com/p/robotframework/source/detail?r=dc7ce2947b7c
Modified:
/utest/utils/test_markuputils.py
=======================================
--- /utest/utils/test_markuputils.py Wed Oct 16 12:11:22 2013 UTC
+++ /utest/utils/test_markuputils.py Thu Jun 12 08:29:12 2014 UTC
@@ -294,10 +294,18 @@
def test_link_is_required(self):
assert_format('[|]', '[|]', p=True)
- def test_whitespace_is_strip(self):
+ def test_spaces_are_stripped(self):
assert_format('[ link.html | title words ]',
'<a href="link.html">title words</a>', p=True)
+ def test_newlines_inside_text(self):
+ assert_format('[http://url|text\non\nmany\nlines]',
+ '<a href="http://url">text on many lines</a>',
p=True)
+
+ def test_newline_after_pipe(self):
+ assert_format('[http://url|\nwrapping was needed]',
+ '<a href="http://url">wrapping was needed</a>',
p=True)
+
def test_url_and_link(self):
assert_format('http://url [link|title]',
'<a href="http://url">http://url</a> <a
href="link">title</a>',
==============================================================================
Revision: de53c4ed0ef1
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 08:30:57 2014 UTC
Log: AUTHORS: Added Michael Walle who implemented Telnet.Write Control
Character.
Update issue 1729
Status: Done
Added Michael to AUTHORS. Thanks again for your contribution!
http://code.google.com/p/robotframework/source/detail?r=de53c4ed0ef1
Modified:
/AUTHORS.txt
=======================================
--- /AUTHORS.txt Tue Apr 22 14:15:18 2014 UTC
+++ /AUTHORS.txt Thu Jun 12 08:30:57 2014 UTC
@@ -44,3 +44,4 @@
Mirel Pehadzic Terminal emulation for Telnet library
(2.8.2)
Diogo Sa-Chaves De Oliveira Terminal emulation for Telnet library
(2.8.2)
Lionel Perrin Giving custom seed to --randomize (2.8.5)
+Michael Walle Telnet.Write Control Character keyword
(2.8.5)
==============================================================================
Revision: a9d8dff72f01
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 08:50:24 2014 UTC
Log: DateTime: Specify custom timestamp format w/o 'timestamp:' prefix.
Update issue 415
We decided to drop 'timestamp:' prefix when specifying custom timestamp
format.
It is easy enough to check does the format contain '%' character or not.
http://code.google.com/p/robotframework/source/detail?r=a9d8dff72f01
Modified:
/atest/testdata/standard_libraries/datetime/add_to_date.txt
/atest/testdata/standard_libraries/datetime/convert_date_result_format.txt
/atest/testdata/standard_libraries/datetime/subtract_from_date.txt
/src/robot/libraries/DateTime.py
=======================================
--- /atest/testdata/standard_libraries/datetime/add_to_date.txt Mon May 26
12:20:29 2014 UTC
+++ /atest/testdata/standard_libraries/datetime/add_to_date.txt Thu Jun 12
08:50:24 2014 UTC
@@ -11,10 +11,10 @@
Time addition to date should succeed
${DATE1} 1 hour ${DATE2}
${DATE1} 1h ${DATE2}
- 22:45:12 2014.04.24 01:02:01.000 23:47:13 2014.04.24
timestamp:%H:%M:%S %Y.%m.%d %H:%M:%S %Y.%m.%d
+ 22:45:12 2014.04.24 01:02:01.000 23:47:13
2014.04.24 %H:%M:%S %Y.%m.%d
*** Keywords ***
Addition Should Succeed
- [Arguments] ${date} ${time} ${expected}
${result_format}=datetime ${input_format}=${NONE}
- ${new_date} = Add To Date ${date} ${time}
${result_format} date_format=${input_format}
+ [Arguments] ${date} ${time} ${expected} ${format}=datetime
+ ${new_date} = Add To Date ${date} ${time} ${format}
date_format=${format}
Should Be Equal ${new_date} ${expected}
=======================================
---
/atest/testdata/standard_libraries/datetime/convert_date_result_format.txt
Fri May 30 15:07:26 2014 UTC
+++
/atest/testdata/standard_libraries/datetime/convert_date_result_format.txt
Thu Jun 12 08:50:24 2014 UTC
@@ -6,43 +6,43 @@
*** Variables ***
${DATE} ${datetime(2014, 4, 24, 21, 45, 12, 123000)}
-*** Test Cases *** INPUT
FORMAT OUTPUT INPUT FORMAT
+*** Test Cases *** INPUT FORMAT
OUTPUT INPUT FORMAT
Should convert to timestamp
- 2014-04-24 21:45:12.123
timeSTAMP 2014-04-24 21:45:12.123
- 2014-04-24 21:45:12.123
tImestamp 2014-04-24
21:45:12.123 %Y-%m-%d %H:%M:%S.%f
- ${EPOCH}
TIMEstamp 2014-04-24 21:45:12.000
- ${DATE}
TimeStamp 2014-04-24 21:45:12.123
+ 2014-04-24 21:45:12.123 timeSTAMP
2014-04-24 21:45:12.123
+ 2014-04-24 21:45:12.123 tImestamp
2014-04-24 21:45:12.123 %Y-%m-%d %H:%M:%S.%f
+ ${EPOCH} TIMEstamp
2014-04-24 21:45:12.000
+ ${DATE} TimeStamp
2014-04-24 21:45:12.123
Should convert to timestamp with format
- 2014-04-24 21:45:12.123
TimeStamp:%H:%M:%S %Y-%m-%d 21:45:12 2014-04-24
- 2014/04/24 21:45:12.123
timestamp:%H:%M %Y-%m-%d 21:45
2014-04-24 %Y/%m/%d %H:%M:%S.%f
+ 2014-04-24 21:45:12.123 %H:%M:%S %Y-%m-%d
21:45:12 2014-04-24
+ 2014/04/24 21:45:12.123 %H:%M %Y-%m-%d
21:45 2014-04-24 %Y/%m/%d %H:%M:%S.%f
Should convert to epoch
- 2014-04-24 21:45:12.123
epoch ${EPOCH + 0.123}
- 2014-04-24 21:45:12.123
epoch ${EPOCH +
0.123} %Y-%m-%d %H:%M:%S.%f
- ${EPOCH}
epoch ${EPOCH}
- ${DATE}
epoch ${EPOCH + 0.123}
+ 2014-04-24 21:45:12.123 epoch
${EPOCH + 0.123}
+ 2014-04-24 21:45:12.123 epoch
${EPOCH + 0.123} %Y-%m-%d %H:%M:%S.%f
+ ${EPOCH} epoch
${EPOCH}
+ ${DATE} epoch
${EPOCH + 0.123}
Should convert to datetime
- 2014-04-24 21:45:12.123
datetime ${DATE}
- 2014-04-24 21:45:12.123
datetime
${DATE} %Y-%m-%d %H:%M:%S.%f
- ${EPOCH + 0.123}
dateTiMe ${DATE}
- ${DATE}
datetimE ${DATE}
+ 2014-04-24 21:45:12.123 datetime
${DATE}
+ 2014-04-24 21:45:12.123 datetime
${DATE} %Y-%m-%d %H:%M:%S.%f
+ ${EPOCH + 0.123} dateTiMe
${DATE}
+ ${DATE} datetimE
${DATE}
Should exclude milliseconds
[Template] Date Conversion Should Succeed Without
Milliseconds
- 2014-04-24 21:45:12.123
timestamp 2014-04-24 21:45:12
- 2014-04-24 21:45:12.999
timestamp 2014-04-24 21:45:13
- ${DATE}
timestamp 2014-04-24 21:45:12
- ${EPOCH + 0.123}
datetime ${datetime(2014, 4, 24, 21, 45, 12)}
+ 2014-04-24 21:45:12.123 timestamp
2014-04-24 21:45:12
+ 2014-04-24 21:45:12.999 timestamp
2014-04-24 21:45:13
+ ${DATE} timestamp
2014-04-24 21:45:12
+ ${EPOCH + 0.123} datetime
${datetime(2014, 4, 24, 21, 45, 12)}
Formatted with %f in middle
[Template] NONE
Run Keyword If sys.version_info < (2, 6) or sys.platform == 'cli'
... Run Keyword And Expect Error ValueError: %f directive is
supported only at the end of the format string on this Python interpreter.
- ... Date Conversion Should Succeed 2014-04-24 21:45:12.123
TimeStamp:%H:%M:%S.%f %Y-%m-%d 21:45:12.123000 2014-04-24
+ ... Date Conversion Should Succeed 2014-04-24
21:45:12.123 %H:%M:%S.%f %Y-%m-%d 21:45:12.123000 2014-04-24
... ELSE
- ... Date Conversion Should Succeed 2014-04-24 21:45:12.123
TimeStamp:%H:%M:%S.%f %Y-%m-%d 21:45:12.123000 2014-04-24
+ ... Date Conversion Should Succeed 2014-04-24
21:45:12.123 %H:%M:%S.%f %Y-%m-%d 21:45:12.123000 2014-04-24
*** Keywords ***
Date Conversion Should Succeed
=======================================
--- /atest/testdata/standard_libraries/datetime/subtract_from_date.txt Mon
May 26 12:20:29 2014 UTC
+++ /atest/testdata/standard_libraries/datetime/subtract_from_date.txt Thu
Jun 12 08:50:24 2014 UTC
@@ -11,11 +11,11 @@
Time subtraction from date should succeed
${DATE2} 1 hour ${DATE1}
${DATE2} ${timedelta(hours=1)} ${DATE1}
- 23:47:13 2014.04.24 01:02:01.000 22:45:12
2014.04.24 %H:%M:%S %Y.%m.%d timestamp:%H:%M:%S %Y.%m.%d
- 23:47:13 2014.04.24 00:00:00.100 23:47:12
2014.04.24 %H:%M:%S %Y.%m.%d timestamp:%H:%M:%S %Y.%m.%d
+ 23:47:13 2014.04.24 01:02:01.000 22:45:12
2014.04.24 %H:%M:%S %Y.%m.%d
+ 23:47:13 2014.04.24 00:00:00.100 23:47:12
2014.04.24 %H:%M:%S %Y.%m.%d
*** Keywords ***
Time Subtraction Should Succeed
- [Arguments] ${date} ${time} ${expected}
${input_format}=${NONE} ${result_format}=datetime
- ${new_date} = Subtract From Date ${date} ${time}
${result_format} date_format=${input_format}
+ [Arguments] ${date} ${time} ${expected} ${format}=datetime
+ ${new_date} = Subtract From Date ${date} ${time}
${format} date_format=${format}
Should Be Equal ${new_date} ${expected}
=======================================
--- /src/robot/libraries/DateTime.py Tue Jun 10 10:35:48 2014 UTC
+++ /src/robot/libraries/DateTime.py Thu Jun 12 08:50:24 2014 UTC
@@ -523,10 +523,8 @@
return time.mktime(dt.timetuple()) + dt.microsecond / 10.0**6
def convert(self, format, millis=True):
- if ':' in format:
- format, output_format = format.split(':', 1)
- return self._convert_to_timestamp(self.seconds, millis,
- output_format)
+ if '%' in format:
+ return self._convert_to_timestamp(self.seconds, millis, format)
try:
result_converter = getattr(self, '_convert_to_%s' %
format.lower())
except AttributeError:
==============================================================================
Revision: 4bd2a80b4e26
Branch: default
Author: Pekka Klärck
Date: Thu Jun 12 09:22:55 2014 UTC
Log: DateTime: More tests and one fix for handling millis
Update issue 415
- Fixed rounding millis to seconds in output with custom timestamps.
- Time as number and date as epoch always as float.
- Some more tests for handling millis in general.
http://code.google.com/p/robotframework/source/detail?r=4bd2a80b4e26
Modified:
/atest/robot/standard_libraries/datetime/convert_date_result_format.txt
/atest/robot/standard_libraries/datetime/convert_time_result_format.txt
/atest/testdata/standard_libraries/datetime/convert_date_result_format.txt
/atest/testdata/standard_libraries/datetime/convert_time_result_format.txt
/src/robot/libraries/DateTime.py
=======================================
--- /atest/robot/standard_libraries/datetime/convert_date_result_format.txt
Fri May 30 15:07:26 2014 UTC
+++ /atest/robot/standard_libraries/datetime/convert_date_result_format.txt
Thu Jun 12 09:22:55 2014 UTC
@@ -18,6 +18,9 @@
Should exclude milliseconds
Check Test Case ${TESTNAME}
+
+Epoch time is float regardless are millis included or not
+ Check Test Case ${TESTNAME}
Formatted with %f in middle
Check Test Case ${TESTNAME}
=======================================
--- /atest/robot/standard_libraries/datetime/convert_time_result_format.txt
Thu Jun 5 08:56:18 2014 UTC
+++ /atest/robot/standard_libraries/datetime/convert_time_result_format.txt
Thu Jun 12 09:22:55 2014 UTC
@@ -4,7 +4,7 @@
Resource atest_resource.txt
*** Test Cases ***
-Convert to seconds
+Convert to number
Check Test Case ${TESTNAME}
Convert to string
@@ -21,6 +21,9 @@
Ignore millis
Check Test Case ${TESTNAME}
+
+Number is float regardless are millis included or not
+ Check Test Case ${TESTNAME}
Invalid format
Check Test Case ${TESTNAME}
=======================================
---
/atest/testdata/standard_libraries/datetime/convert_date_result_format.txt
Thu Jun 12 08:50:24 2014 UTC
+++
/atest/testdata/standard_libraries/datetime/convert_date_result_format.txt
Thu Jun 12 09:22:55 2014 UTC
@@ -15,6 +15,7 @@
Should convert to timestamp with format
2014-04-24 21:45:12.123 %H:%M:%S %Y-%m-%d
21:45:12 2014-04-24
+ 2014-04-24 21:45:12.999 %H:%M:%S %Y-%m-%d
21:45:12 2014-04-24
2014/04/24 21:45:12.123 %H:%M %Y-%m-%d
21:45 2014-04-24 %Y/%m/%d %H:%M:%S.%f
Should convert to epoch
@@ -34,10 +35,22 @@
2014-04-24 21:45:12.123 timestamp
2014-04-24 21:45:12
2014-04-24 21:45:12.999 timestamp
2014-04-24 21:45:13
${DATE} timestamp
2014-04-24 21:45:12
+ ${EPOCH + 0.123} %Y-%m-%d %H:%M:%S
2014-04-24 21:45:12
+ ${EPOCH + 0.500} %Y-%m-%d %H:%M:%S
2014-04-24 21:45:13
${EPOCH + 0.123} datetime
${datetime(2014, 4, 24, 21, 45, 12)}
+ ${EPOCH + 0.500} datetime
${datetime(2014, 4, 24, 21, 45, 13)}
+ ${EPOCH + 0.123} epoch
${EPOCH}
+ ${EPOCH + 0.500} epoch
${EPOCH + 1}
+
+Epoch time is float regardless are millis included or not
+ [Template] Epoch time format should be
+ ${1000.123} 1000.123
+ ${1000} 1000.0
+ ${1000.123} 1000.0 no
millis
+ ${1000} 1000.0 no
millis
Formatted with %f in middle
- [Template] NONE
+ [Template] NONE
Run Keyword If sys.version_info < (2, 6) or sys.platform == 'cli'
... Run Keyword And Expect Error ValueError: %f directive is
supported only at the end of the format string on this Python interpreter.
... Date Conversion Should Succeed 2014-04-24
21:45:12.123 %H:%M:%S.%f %Y-%m-%d 21:45:12.123000 2014-04-24
@@ -54,3 +67,8 @@
[Arguments] ${input} ${output_format} ${expected}
${ts} = Convert Date ${input} ${output_format}
exclude_millis=True
Should Be Equal ${ts} ${expected}
+
+Epoch time format should be
+ [Arguments] ${input} ${expected} ${millis}=
+ ${result} = Convert Date ${input} result_format=epoch
exclude_millis=${millis}
+ Should Be Equal As Strings ${result} ${expected}
=======================================
---
/atest/testdata/standard_libraries/datetime/convert_time_result_format.txt
Thu Jun 5 08:56:18 2014 UTC
+++
/atest/testdata/standard_libraries/datetime/convert_time_result_format.txt
Thu Jun 12 09:22:55 2014 UTC
@@ -4,7 +4,7 @@
Variables datesandtimes.py
*** Test Cases *** INPUT FORMAT EXPECTED
-Convert to seconds 10 s number ${10}
+Convert to number 10 s number ${10}
${-62.3} NUMBER ${-62.3}
${timedelta(2)} NUMber ${172800}
@@ -32,6 +32,13 @@
61.5 compact 1min 2s
61.5 timer 00:01:02
61.5 timedelta
${timedelta(seconds=62)}
+
+Number is float regardless are millis included or not
+ [Template] Number format should be
+ ${1000.123} 1000.123
+ ${1000} 1000.0
+ ${1000.123} 1000.0 no millis
+ ${1000} 1000.0 no millis
Invalid format [Documentation] FAIL ValueError: Unknown
format 'invalid'.
10s invalid 0
@@ -46,3 +53,8 @@
[Arguments] ${input} ${format} ${expected}
${result} = Convert Time ${input} ${format}
exclude_millis=Yes
Should Be Equal ${result} ${expected}
+
+Number format should be
+ [Arguments] ${input} ${expected} ${millis}=
+ ${result} = Convert Time ${input} result_format=number
exclude_millis=${millis}
+ Should Be Equal As Strings ${result} ${expected}
=======================================
--- /src/robot/libraries/DateTime.py Thu Jun 12 08:50:24 2014 UTC
+++ /src/robot/libraries/DateTime.py Thu Jun 12 09:22:55 2014 UTC
@@ -422,10 +422,11 @@
class Time(object):
+
def __init__(self, time):
- self.seconds = self._convert_to_seconds(time)
+ self.seconds = self._convert_time_to_seconds(time)
- def _convert_to_seconds(self, time):
+ def _convert_time_to_seconds(self, time):
if isinstance(time, timedelta):
# timedelta.total_seconds() is new in Python 2.7
return (time.days * 24 * 60 * 60 + time.seconds +
@@ -437,7 +438,7 @@
result_converter = getattr(self, '_convert_to_%s' %
format.lower())
except AttributeError:
raise ValueError("Unknown format '%s'." % format)
- seconds = self.seconds if millis else int(round(self.seconds))
+ seconds = self.seconds if millis else round(self.seconds)
return result_converter(seconds, millis)
def _convert_to_number(self, seconds, millis=True):
@@ -471,9 +472,9 @@
class Date(object):
def __init__(self, date, input_format=None):
- self.seconds = self._convert_to_seconds(date, input_format)
+ self.seconds = self._convert_date_to_seconds(date, input_format)
- def _convert_to_seconds(self, date, input_format):
+ def _convert_date_to_seconds(self, date, input_format):
if isinstance(date, basestring):
seconds = self._string_to_epoch(date, input_format)
elif isinstance(date, datetime):
@@ -523,13 +524,13 @@
return time.mktime(dt.timetuple()) + dt.microsecond / 10.0**6
def convert(self, format, millis=True):
+ seconds = self.seconds if millis else round(self.seconds)
if '%' in format:
- return self._convert_to_timestamp(self.seconds, millis, format)
+ return self._convert_to_timestamp(seconds, millis, format)
try:
result_converter = getattr(self, '_convert_to_%s' %
format.lower())
except AttributeError:
raise ValueError("Unknown format '%s'." % format)
- seconds = self.seconds if millis else round(self.seconds)
return result_converter(seconds, millis)
def _convert_to_timestamp(self, seconds, millis=True,
output_format=None):
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.