From 11d0d7a7525ad1423b0309b12e6db4fcfafcb40f Mon Sep 17 00:00:00 2001 From: James Jia <32031865+wenzhaojia2000@users.noreply.github.com> Date: Thu, 3 Nov 2022 10:10:25 +0000 Subject: [PATCH 1/2] Adds test to times.py --- .../test_times.cpython-38-pytest-7.1.2.pyc | Bin 0 -> 1123 bytes __pycache__/times.cpython-38.pyc | Bin 0 -> 1265 bytes test_times.py | 8 ++++++++ times.py | 7 +------ 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 __pycache__/test_times.cpython-38-pytest-7.1.2.pyc create mode 100644 __pycache__/times.cpython-38.pyc create mode 100644 test_times.py diff --git a/__pycache__/test_times.cpython-38-pytest-7.1.2.pyc b/__pycache__/test_times.cpython-38-pytest-7.1.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8eeaf834a45d2457175f1c7e187af18541dcde02 GIT binary patch literal 1123 zcmZWp&rcIU6rP#xw%bx_1!6=mdoghjkZlWU2sIc)FNPQim!@V}cBbvh{>sc0EZJUw zi-~`N2kOn6NB@?+dg5Q;lY8@S`2nmW|sZ$D#jsbpwYGxa6rads)?VHoEK<0)q0p#6yGBgjm}8zT%VwWqS%9YF(nhsKY>+JRz&Cw ztzIimazz0YUvmXmps3Q>Z{z_Q>$FDirMi#7E=mIw<+M1#r}zZwG}b7B3e>lc=bLuJ zUa}iYji%YK*KGB>O*W_GccHi;bAaFQKxazvgSyqLxvp@6$=|_+&h(RH;hmIJ;!+_>e zrys=oZs0_2$g;8{+#XXqWVKg$YCn#)IFETY@AP6Gy3&Dz25#g^h*+hL9=IIdGaYv1 zl9$!N)VrR|sLa#TH#)g9UEZ2Trq1dQ#1}z*dA7OM-G!Tq9J{Y$Zy2&jitd{@pp18S zH{Y2bn23kmW1`!%o6RMFmg1Ppy@9zC_v8`W*xZWxe#98}qrQ3M%YpfRBnNTSed|k5 zC$Z?NFF-7*qJgbSmlMm$D68jg-#=uL<45q>s1l0>0E8>J2GhU>($F5Nq8j3lfwwA| zaaCVl2O?W^rX5+HULLBn%-Iq5B~nb$3qie zS%IZy065_^C0m4-xx?KgR?)w0||9>rZ|8mAIJ$U zz}+eP!mc!mTHh_)V|I_6uv1d7X>v?C!!HNhB$*;#$PqcBN37}C6nyOzY(Uq@fc8s} zjC)9m5^9i+w|;)7_I|e3nXU0^?bTxK&0=jsG6)}IhQomdAJzmc^$MUx3bMV@r^lEW zE$A@>2Ba9Cldp7&40kxn|Lr!}H@53S0xY1WtVEn=T-mq*Gd_>B&`C#_5kxLh9f6t6 z%^RA0cMRobsugv^9ijJy$igJkLhePW3Y8gEI+8lXd!hPH&Ofg%Ha3-z%3@2{=j-)ZfTw5^k&N5bjl8M%BPpuSvsRJ`A(O0C-A{D8 z`u0G#^Q`eQ(Qvw(s|E&Dvsx%{Z{@k}fvGH|iPCZ2=`JIK3c+LS;sKrc^=ZcDDWj|< z=9bbthJRQFVR+%M8en5!lWd@uM*y}44;!pc`>dcR!22mJ*yZ;Rzf|HqAlX-1HZfe_ z$TFA=(-Ev4IR?rljH7fL;1(=}&FH}lTv-CqI_RPUGp2JLrQuc8Ov&aSc&2jAz41lH zZ57N!*6ZvD8RpIFLP?BZD#J5Sw-N9bT1S_;jKBej37N_@N0^dABcbCkt8|=s7oH=h z!4hMS4hP;wu2x~G7XU2+9FaA${S5eW-~qvN*nR?Xsqbl0I7Ml|`ejWEx9~vnfk#%9 z3%|)uDJ8p;yI_HCrR#xXoKEx+Ajymub-VBn!HDr}>I+xjx*5&)giN7FEn%J|X2G~{ z7|vL&Zne5`(tO{z?WEQIrxIooo2I8lc+(gD{S^f+9feted6&w^U=NsmK@wjsR2i#g csj-_kyxWRfZvCZB&U>j?#w)hszEi3E1{)YOkpKVy literal 0 HcmV?d00001 diff --git a/test_times.py b/test_times.py new file mode 100644 index 0000000..72ee696 --- /dev/null +++ b/test_times.py @@ -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 \ No newline at end of file diff --git a/times.py b/times.py index d57f401..a7361a1 100644 --- a/times.py +++ b/times.py @@ -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)) \ No newline at end of file + return overlap_time \ No newline at end of file From 42908a4ece2dcc053d38416f9b31e35203589305 Mon Sep 17 00:00:00 2001 From: wenzhaojia2000 <32031865+wenzhaojia2000@users.noreply.github.com> Date: Tue, 20 Dec 2022 18:13:28 +0000 Subject: [PATCH 2/2] Prepare for archive --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 58c714b..5f46b0d 100644 --- a/README.md +++ b/README.md @@ -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