Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# COMP-0233 Archive

This fork is part of one of the exercises in UCL's COMP0233 ["Research Software Engineering with Python"](https://github.com/UCL-COMP0233-22-23/RSE-Classwork) course. The course is completed, and all repositories are now archived.

([The following group work](https://github.com/bwan1/times-tests/tree/james).)

---

In this exercise, you will be given a few lines of code that perform a certain task (that you will have to understand) and then write an automated test that checks whether that task is performed correctly.

## Step 0
Expand Down
Binary file not shown.
Binary file added __pycache__/times.cpython-38.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions test_times.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from times import time_range, compute_overlap_time

def test_given_input():
large = time_range("2010-01-12 10:00:00", "2010-01-12 12:00:00")
short = time_range("2010-01-12 10:30:00", "2010-01-12 10:45:00", 2, 60)
result = compute_overlap_time(large, short)
expected = [('2010-01-12 10:30:00', '2010-01-12 10:37:00'), ('2010-01-12 10:38:00', '2010-01-12 10:45:00')]
assert result == expected
7 changes: 1 addition & 6 deletions times.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@ def compute_overlap_time(range1, range2):
low = max(start1, start2)
high = min(end1, end2)
overlap_time.append((low, high))
return overlap_time

if __name__ == "__main__":
large = time_range("2010-01-12 10:00:00", "2010-01-12 12:00:00")
short = time_range("2010-01-12 10:30:00", "2010-01-12 10:45:00", 2, 60)
print(compute_overlap_time(large, short))
return overlap_time