Skip to content

Commit

Permalink
Accept float type for idle_time_limit in Asciicast V2 header
Browse files Browse the repository at this point in the history
Fixes nbedos#97
  • Loading branch information
nbedos committed Jun 14, 2019
1 parent 8e4b269 commit 1980275
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion termtosvg/asciicast.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class AsciiCastV2Header(AsciiCastV2Record, _AsciiCastV2Header):
'width': int,
'height': int,
'theme': (type(None), AsciiCastV2Theme),
'idle_time_limit': (type(None), int)
'idle_time_limit': (type(None), int, float)
}

def __new__(cls, version, width, height, theme, idle_time_limit=None):
Expand Down
3 changes: 3 additions & 0 deletions termtosvg/tests/test_asciicast.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def palette(n):
'{"version": 2, "width": 212, "height": 53, "timestamp": 123456798123}',
# Header: idle_time_limit
'{"version": 2, "width": 212, "height": 53, "timestamp": 123456798123, "idle_time_limit": 42}',
# Float idle time limit (https://github.com/nbedos/termtosvg/issues/97)
'{"version": 2, "width": 212, "height": 53, "idle_time_limit": 1.234}',
# Event: Non printable characters
'[0.010303, "o", "\\u001b[1;31mnico \\u001b[0;34m~\\u001b[0m"]',
# Event: Unicode characters
Expand All @@ -51,6 +53,7 @@ def palette(n):
AsciiCastV2Header(2, 212, 53, color_theme_16),
AsciiCastV2Header(2, 212, 53, None),
AsciiCastV2Header(2, 212, 53, None, 42),
AsciiCastV2Header(2, 212, 53, None, 1.234),
AsciiCastV2Event(0.010303, 'o', '\u001b[1;31mnico \u001b[0;34m~\u001b[0m', None),
AsciiCastV2Event(1.146397, 'o', '❤ ☀ ☆ ☂ ☻ ♞ ☯ ☭ ☢ € →', None),
AsciiCastV2Event(2, 'o', '\r\n', None),
Expand Down

0 comments on commit 1980275

Please sign in to comment.