From 9ba2b17516351f2e389d0e12db1fc5bd7f15eb44 Mon Sep 17 00:00:00 2001 From: mikf <mikf@dtu.dk> Date: Wed, 27 Jun 2018 09:32:25 +0200 Subject: [PATCH] added test-file to optimization recording testing and tests to the utility module --- .../recordings/cases_20180621_111710.sql | Bin 0 -> 65536 bytes topfarm/tests/topfarm/test_utils.py | 32 ++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 topfarm/tests/test_files/recordings/cases_20180621_111710.sql create mode 100644 topfarm/tests/topfarm/test_utils.py diff --git a/topfarm/tests/test_files/recordings/cases_20180621_111710.sql b/topfarm/tests/test_files/recordings/cases_20180621_111710.sql new file mode 100644 index 0000000000000000000000000000000000000000..333ed874528c1456d084669030001f40fc79731a GIT binary patch literal 65536 zcmeHQeOy#k-oNw0yu%C#ip(gZpg<zRNQQ`UFwk@m1k?sy8;6;zGdeHadC@fSLBmSK zwk@is%(AVuv>toW_2Vk8cT0WL&CE}(`ADU0uBp4N_|l5H%5(1Pyf9>+%|Dtx=YHVc zdtUGPeb4vz<=k`cJ=E1yI{dhPp2zF5`1PYP4JHs^K(EIzObvfE@R!?U@I=f7;875A z-q)!b8+pqcuNsOe<ySHFi|XVAWqh{k9;Hk9jbf)VPkvSLXkSH9JVF2=fDk|kAOsKs z2myq^-9li6SRoxSVuWBtso&Dz#C;y;BHU|s;eLzF;<rQul@HWblufVDPcNHLS)q?e z%y!uH(<@BV_0wu6Pc5sh*BdM9bGb~OM!&=3_UR{7R!`s~txk*2N0-SNuapd^86m(N zZX5oHk8r|qsM!+md+4w^;!5U%hzONe#u%Yxj9B9H<F23);X!%05#fn_7-6+I9q#$& zc^0eR<7KSK8883ACWqGxn;agY@JpB`r_)Wgc^#p+M+Bu|O^!&6-ei}@hC9uR9Qb0` zom5xS(C3Vo{!pVMYBm={L{OuC>K9w_Xq<Gws8NE)hJ~^QcAD2h_cPl+!3as11-+6f z8zxsxub5O(8%`gqC*X#)Qi-{GzB;qj<MG-YZVS9yp(vND_d8s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ELw~KoIzl)Xzv_l9W1P}rUfuB19t$HOK+~$ORAEgW(+!oMp zw@#E?I~MDs+ow|#Pwas+q=ybo@mz=Z|5a;h4t)T_ZOxahS76u^Uo-PmPw)e&rlzZJ zUxYKHO9Q#<Q~H?cL8IH)8QnhYm<|6&QS6Uylm0$tT{S2HOI8%aS5-7%NBs9YMuL3M zvV47AB`|=DrPJC^^$Y<69G72DhhdiYfaCWL-?e^vI79lI%Ud?-F%@9_f&W0txnRMN zc>ezXTnXzZfb)m?;?G|i4$G?)dDF@uo~-}yesb=1TG2pQ{_)n&8ZPwlWFeMDx2@@l zUibfsP>CE%-~Zq2tc`Vr{9j!jxdfAuM(zH&3o#uzb@$U-uS10#*;Mo~>~S*t``O<B zOw7-vuWWqdWj&Szu3tNMy#Xm?W311RW)2+O^Gi_3jOWIT%Y+Jvzkc#vN+I9WRcKF? z<^$Q#Kd##g6>-(`8`>5^g)F#{F@6#Zv%Ci!zhAy|F8!k(EjXcgL${|#30QyNdB5PG z@BSR9Y|P;9bP4Mxfb)l0uiZCX1QoJ-ynAg^&$Uw4e|SIH829V>aO44`vH_CyzW{~& EfA^zzHvj+t literal 0 HcmV?d00001 diff --git a/topfarm/tests/topfarm/test_utils.py b/topfarm/tests/topfarm/test_utils.py new file mode 100644 index 00000000..055807cd --- /dev/null +++ b/topfarm/tests/topfarm/test_utils.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from topfarm import TopFarm +import numpy as np +from topfarm.cost_models.cost_model_wrappers import CostModelComponent +import pytest +import os + +from topfarm.utils import pos_from_case, latest_id + +thisdir = os.path.dirname(os.path.abspath(__file__)) +turbines = np.array([[ 2.4999377 , -2.99987763], + [ 6. , -6.99997496], + [ 4.49993771, -2.99985273], + [ 3.00004123, -6.9999519 ]]) + +def test_pos_from_case(): + crf = "..\\test_files\\recordings\cases_20180621_111710.sql" + path = os.path.join(thisdir, crf) + np.testing.assert_allclose(turbines, pos_from_case(path)) + + +def test_latest_id(): + crd = "..\\test_files\\recordings" + path = os.path.join(thisdir, crd) + ref_path = os.path.join(path,'cases_20180621_111710.sql') + assert latest_id(path) == ref_path + + +if __name__ == '__main__': + test_pos_from_case() + test_latest_id() +# pass \ No newline at end of file -- GitLab