Skip to content

Commit cb78d35

Browse files
author
Philip de Nier
authored
Merge pull request #39 from bbc/philipn-var-name-typos
correct inclusivity names in timerange_between
2 parents 5a82373 + ee76743 commit cb78d35

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# mediatimestamp Changelog
22

3+
## 1.7.1
4+
- Correct inclusivity names in `timerange_between` method.
5+
36
## 1.7.0
47
- Added extend_to_encompass_timerange function for immutable.TimeRange.
58
- Hardcode use of python3.4 in RPM spec file to workaround missing python3 soft

mediatimestamp/immutable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,16 +1179,16 @@ def timerange_between(self, other):
11791179
elif self.is_earlier_than_timerange(other):
11801180
inclusivity = TimeRange.EXCLUSIVE
11811181
if not self.includes_end():
1182-
inclusivity |= TimeRange.INLCUDE_START
1182+
inclusivity |= TimeRange.INCLUDE_START
11831183
if not other.includes_start():
11841184
inclusivity |= TimeRange.INCLUDE_END
11851185
return TimeRange(self.end, other.start, inclusivity)
11861186
else:
11871187
inclusivity = TimeRange.EXCLUSIVE
11881188
if not self.includes_start():
1189-
inclusivity |= TimeRange.INLCUDE_END
1189+
inclusivity |= TimeRange.INCLUDE_END
11901190
if not other.includes_end():
1191-
inclusivity |= TimeRange.INCLUDE_start
1191+
inclusivity |= TimeRange.INCLUDE_START
11921192
return TimeRange(other.end, self.start, inclusivity)
11931193

11941194
def is_empty(self):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# Basic metadata
2020
name = 'mediatimestamp'
21-
version = '1.7.0.post0'
21+
version = '1.7.1'
2222
description = 'A timestamp library for high precision nanosecond timestamps'
2323
url = 'https://github.com/bbc/rd-apmm-python-lib-mediatimestamp'
2424
author = 'James P. Weaver'

tests/test_immutable.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,25 @@ def test_split(self):
14661466
with self.assertRaises(ValueError):
14671467
tr.split_at(ts)
14681468

1469+
def test_timerange_between(self):
1470+
test_data = [
1471+
(TimeRange.from_str("[0:0_10:0)"), TimeRange.from_str("[5:0_15:0)"),
1472+
TimeRange.never()),
1473+
(TimeRange.from_str("[0:0_10:0)"), TimeRange.from_str("[15:0_20:0)"),
1474+
TimeRange.from_str("[10:0_15:0)")),
1475+
(TimeRange.from_str("[0:0_10:0]"), TimeRange.from_str("(15:0_20:0)"),
1476+
TimeRange.from_str("(10:0_15:0]")),
1477+
(TimeRange.from_str("[0:0_10:0)"), TimeRange.from_str("[15:0_20:0)"),
1478+
TimeRange.from_str("[10:0_15:0)")),
1479+
(TimeRange.from_str("[0:0_10:0]"), TimeRange.from_str("(15:0_20:0)"),
1480+
TimeRange.from_str("(10:0_15:0]")),
1481+
]
1482+
1483+
for (left, right, expected) in test_data:
1484+
with self.subTest(left=left, right=right, expected=expected):
1485+
self.assertEqual(left.timerange_between(right), expected)
1486+
self.assertEqual(right.timerange_between(left), expected)
1487+
14691488
def test_normalise(self):
14701489
tests_tr = [
14711490
(TimeRange.from_str("[0:0_1:0)"), Fraction(25, 1), TimeRange.ROUND_NEAREST,

0 commit comments

Comments
 (0)