1.1 --- a/tests/qualifiers.py Sat Oct 04 20:05:17 2014 +0200
1.2 +++ b/tests/qualifiers.py Mon Oct 06 00:17:06 2014 +0200
1.3 @@ -21,9 +21,9 @@
1.4
1.5 s = process(l)
1.6 l = s.materialise(dt, (2003, 12, 24))
1.7 -print len(l) == 7, len(l)
1.8 -print l[0] == (1997, 11, 2), l[0]
1.9 -print l[-1] == (2003, 11, 2), l[-1]
1.10 +print len(l) == 7, 7, len(l)
1.11 +print l[0] == (1997, 11, 2), (1997, 11, 2), l[0]
1.12 +print l[-1] == (2003, 11, 2), (2003, 11, 2), l[-1]
1.13 print
1.14
1.15 qualifiers = [
1.16 @@ -44,9 +44,9 @@
1.17
1.18 s = process(l)
1.19 l = s.materialise(dt, (2003, 12, 24, 0, 0, 0))
1.20 -print len(l) == 32, len(l)
1.21 -print l[0] == (1997, 1, 11, 8, 30, 0), l[0]
1.22 -print l[-1] == (2003, 1, 25, 9, 30, 0), l[-1]
1.23 +print len(l) == 32, 32, len(l)
1.24 +print l[0] == (1997, 1, 11, 8, 30, 0), (1997, 1, 11, 8, 30, 0), l[0]
1.25 +print l[-1] == (2003, 1, 25, 9, 30, 0), (2003, 1, 25, 9, 30, 0), l[-1]
1.26 print
1.27
1.28 qualifiers = [
1.29 @@ -63,9 +63,9 @@
1.30
1.31 s = process(l)
1.32 l = s.materialise(dt, (1997, 12, 24), 10)
1.33 -print len(l) == 10, len(l)
1.34 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.35 -print l[-1] == (1997, 9, 11, 9, 0, 0), l[-1]
1.36 +print len(l) == 10, 10, len(l)
1.37 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.38 +print l[-1] == (1997, 9, 11, 9, 0, 0), (1997, 9, 11, 9, 0, 0), l[-1]
1.39 print
1.40
1.41 qualifiers = [
1.42 @@ -82,9 +82,9 @@
1.43
1.44 s = process(l)
1.45 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
1.46 -print len(l) == 113, len(l)
1.47 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.48 -print l[-1] == (1997, 12, 23, 9, 0, 0), l[-1]
1.49 +print len(l) == 113, 113, len(l)
1.50 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.51 +print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
1.52 print
1.53
1.54 qualifiers = [
1.55 @@ -101,9 +101,9 @@
1.56
1.57 s = process(l)
1.58 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
1.59 -print len(l) == 57, len(l)
1.60 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.61 -print l[-1] == (1997, 12, 23, 9, 0, 0), l[-1]
1.62 +print len(l) == 57, 57, len(l)
1.63 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.64 +print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
1.65 print
1.66
1.67 qualifiers = [
1.68 @@ -120,9 +120,9 @@
1.69
1.70 s = process(l)
1.71 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
1.72 -print len(l) == 17, len(l)
1.73 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.74 -print l[-1] == (1997, 12, 23, 9, 0, 0), l[-1]
1.75 +print len(l) == 17, 17, len(l)
1.76 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.77 +print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
1.78 print
1.79
1.80 qualifiers = [
1.81 @@ -139,9 +139,9 @@
1.82
1.83 s = process(l)
1.84 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 5)
1.85 -print len(l) == 5, len(l)
1.86 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.87 -print l[-1] == (1997, 10, 12, 9, 0, 0), l[-1]
1.88 +print len(l) == 5, 5, len(l)
1.89 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.90 +print l[-1] == (1997, 10, 12, 9, 0, 0), (1997, 10, 12, 9, 0, 0), l[-1]
1.91 print
1.92
1.93 qualifiers = [
1.94 @@ -160,9 +160,9 @@
1.95
1.96 s = process(l)
1.97 l = s.materialise(dt, (2000, 1, 31, 14, 0, 0))
1.98 -print len(l) == 93, len(l)
1.99 -print l[0] == (1998, 1, 1, 9, 0, 0), l[0]
1.100 -print l[-1] == (2000, 1, 31, 9, 0, 0), l[-1]
1.101 +print len(l) == 93, 93, len(l)
1.102 +print l[0] == (1998, 1, 1, 9, 0, 0), (1998, 1, 1, 9, 0, 0), l[0]
1.103 +print l[-1] == (2000, 1, 31, 9, 0, 0), (2000, 1, 31, 9, 0, 0), l[-1]
1.104 print
1.105
1.106 qualifiers = [
1.107 @@ -180,9 +180,9 @@
1.108
1.109 s = process(l)
1.110 l = s.materialise(dt, (2000, 1, 31, 14, 0, 0))
1.111 -print len(l) == 93, len(l)
1.112 -print l[0] == (1998, 1, 1, 9, 0, 0), l[0]
1.113 -print l[-1] == (2000, 1, 31, 9, 0, 0), l[-1]
1.114 +print len(l) == 93, 93, len(l)
1.115 +print l[0] == (1998, 1, 1, 9, 0, 0), (1998, 1, 1, 9, 0, 0), l[0]
1.116 +print l[-1] == (2000, 1, 31, 9, 0, 0), (2000, 1, 31, 9, 0, 0), l[-1]
1.117 print
1.118
1.119 qualifiers = [
1.120 @@ -199,9 +199,9 @@
1.121
1.122 s = process(l)
1.123 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 10)
1.124 -print len(l) == 10, len(l)
1.125 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.126 -print l[-1] == (1997, 11, 4, 9, 0, 0), l[-1]
1.127 +print len(l) == 10, 10, len(l)
1.128 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.129 +print l[-1] == (1997, 11, 4, 9, 0, 0), (1997, 11, 4, 9, 0, 0), l[-1]
1.130 print
1.131
1.132 qualifiers = [
1.133 @@ -218,9 +218,9 @@
1.134
1.135 s = process(l)
1.136 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
1.137 -print len(l) == 17, len(l)
1.138 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.139 -print l[-1] == (1997, 12, 23, 9, 0, 0), l[-1]
1.140 +print len(l) == 17, 17, len(l)
1.141 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.142 +print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
1.143 print
1.144
1.145 qualifiers = [
1.146 @@ -237,9 +237,9 @@
1.147
1.148 s = process(l)
1.149 l = s.materialise(dt, (1998, 2, 20, 0, 0, 0))
1.150 -print len(l) == 13, len(l)
1.151 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.152 -print l[-1] == (1998, 2, 17, 9, 0, 0), l[-1]
1.153 +print len(l) == 13, 13, len(l)
1.154 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.155 +print l[-1] == (1998, 2, 17, 9, 0, 0), (1998, 2, 17, 9, 0, 0), l[-1]
1.156 print
1.157
1.158 qualifiers = [
1.159 @@ -257,9 +257,9 @@
1.160
1.161 s = process(l)
1.162 l = s.materialise(dt, (1997, 10, 7, 9, 0, 0))
1.163 -print len(l) == 10, len(l)
1.164 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.165 -print l[-1] == (1997, 10, 2, 9, 0, 0), l[-1]
1.166 +print len(l) == 10, 10, len(l)
1.167 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.168 +print l[-1] == (1997, 10, 2, 9, 0, 0), (1997, 10, 2, 9, 0, 0), l[-1]
1.169 print
1.170
1.171 qualifiers = [
1.172 @@ -277,9 +277,9 @@
1.173
1.174 s = process(l)
1.175 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 10)
1.176 -print len(l) == 10, len(l)
1.177 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.178 -print l[-1] == (1997, 10, 2, 9, 0, 0), l[-1]
1.179 +print len(l) == 10, 10, len(l)
1.180 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.181 +print l[-1] == (1997, 10, 2, 9, 0, 0), (1997, 10, 2, 9, 0, 0), l[-1]
1.182 print
1.183
1.184 qualifiers = [
1.185 @@ -297,9 +297,9 @@
1.186
1.187 s = process(l)
1.188 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
1.189 -print len(l) == 25, len(l)
1.190 -print l[0] == (1997, 9, 1, 9, 0, 0), l[0]
1.191 -print l[-1] == (1997, 12, 22, 9, 0, 0), l[-1]
1.192 +print len(l) == 25, 25, len(l)
1.193 +print l[0] == (1997, 9, 1, 9, 0, 0), (1997, 9, 1, 9, 0, 0), l[0]
1.194 +print l[-1] == (1997, 12, 22, 9, 0, 0), (1997, 12, 22, 9, 0, 0), l[-1]
1.195 print
1.196
1.197 qualifiers = [
1.198 @@ -317,14 +317,14 @@
1.199
1.200 s = process(l)
1.201 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 8)
1.202 -print len(l) == 8, len(l)
1.203 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.204 -print l[-1] == (1997, 10, 16, 9, 0, 0), l[-1]
1.205 +print len(l) == 8, 8, len(l)
1.206 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.207 +print l[-1] == (1997, 10, 16, 9, 0, 0), (1997, 10, 16, 9, 0, 0), l[-1]
1.208 print
1.209
1.210 qualifiers = [
1.211 ("MONTHLY", {"interval" : 1}),
1.212 - ("BYDAY", {"values" : [(5, 0)]})
1.213 + ("BYDAY", {"values" : [(5, 1)]})
1.214 ]
1.215
1.216 l = order_qualifiers(qualifiers)
1.217 @@ -337,14 +337,14 @@
1.218
1.219 s = process(l)
1.220 l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
1.221 -print len(l) == 10, len(l)
1.222 -print l[0] == (1997, 9, 5, 9, 0, 0), l[0]
1.223 -print l[-1] == (1998, 6, 5, 9, 0, 0), l[-1]
1.224 +print len(l) == 10, 10, len(l)
1.225 +print l[0] == (1997, 9, 5, 9, 0, 0), (1997, 9, 5, 9, 0, 0), l[0]
1.226 +print l[-1] == (1998, 6, 5, 9, 0, 0), (1998, 6, 5, 9, 0, 0), l[-1]
1.227 print
1.228
1.229 qualifiers = [
1.230 ("MONTHLY", {"interval" : 1}),
1.231 - ("BYDAY", {"values" : [(5, 0)]})
1.232 + ("BYDAY", {"values" : [(5, 1)]})
1.233 ]
1.234
1.235 l = order_qualifiers(qualifiers)
1.236 @@ -357,14 +357,14 @@
1.237
1.238 s = process(l)
1.239 l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
1.240 -print len(l) == 4, len(l)
1.241 -print l[0] == (1997, 9, 5, 9, 0, 0), l[0]
1.242 -print l[-1] == (1997, 12, 5, 9, 0, 0), l[-1]
1.243 +print len(l) == 4, 4, len(l)
1.244 +print l[0] == (1997, 9, 5, 9, 0, 0), (1997, 9, 5, 9, 0, 0), l[0]
1.245 +print l[-1] == (1997, 12, 5, 9, 0, 0), (1997, 12, 5, 9, 0, 0), l[-1]
1.246 print
1.247
1.248 qualifiers = [
1.249 ("MONTHLY", {"interval" : 2}),
1.250 - ("BYDAY", {"values" : [(7, 0), (7, -1)]})
1.251 + ("BYDAY", {"values" : [(7, 1), (7, -1)]})
1.252 ]
1.253
1.254 l = order_qualifiers(qualifiers)
1.255 @@ -377,9 +377,9 @@
1.256
1.257 s = process(l)
1.258 l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
1.259 -print len(l) == 10, len(l)
1.260 -print l[0] == (1997, 9, 7, 9, 0, 0), l[0]
1.261 -print l[-1] == (1998, 5, 31, 9, 0, 0), l[-1]
1.262 +print len(l) == 10, 10, len(l)
1.263 +print l[0] == (1997, 9, 7, 9, 0, 0), (1997, 9, 7, 9, 0, 0), l[0]
1.264 +print l[-1] == (1998, 5, 31, 9, 0, 0), (1998, 5, 31, 9, 0, 0), l[-1]
1.265 print
1.266
1.267 qualifiers = [
1.268 @@ -397,9 +397,9 @@
1.269
1.270 s = process(l)
1.271 l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 6)
1.272 -print len(l) == 6, len(l)
1.273 -print l[0] == (1997, 9, 22, 9, 0, 0), l[0]
1.274 -print l[-1] == (1998, 2, 16, 9, 0, 0), l[-1]
1.275 +print len(l) == 6, 6, len(l)
1.276 +print l[0] == (1997, 9, 22, 9, 0, 0), (1997, 9, 22, 9, 0, 0), l[0]
1.277 +print l[-1] == (1998, 2, 16, 9, 0, 0), (1998, 2, 16, 9, 0, 0), l[-1]
1.278 print
1.279
1.280 qualifiers = [
1.281 @@ -417,9 +417,9 @@
1.282
1.283 s = process(l)
1.284 l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 6)
1.285 -print len(l) == 6, len(l)
1.286 -print l[0] == (1997, 9, 28, 9, 0, 0), l[0]
1.287 -print l[-1] == (1998, 2, 26, 9, 0, 0), l[-1]
1.288 +print len(l) == 6, 6, len(l)
1.289 +print l[0] == (1997, 9, 28, 9, 0, 0), (1997, 9, 28, 9, 0, 0), l[0]
1.290 +print l[-1] == (1998, 2, 26, 9, 0, 0), (1998, 2, 26, 9, 0, 0), l[-1]
1.291 print
1.292
1.293 qualifiers = [
1.294 @@ -437,9 +437,9 @@
1.295
1.296 s = process(l)
1.297 l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
1.298 -print len(l) == 10, len(l)
1.299 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.300 -print l[-1] == (1998, 1, 15, 9, 0, 0), l[-1]
1.301 +print len(l) == 10, 10, len(l)
1.302 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.303 +print l[-1] == (1998, 1, 15, 9, 0, 0), (1998, 1, 15, 9, 0, 0), l[-1]
1.304 print
1.305
1.306 qualifiers = [
1.307 @@ -457,9 +457,9 @@
1.308
1.309 s = process(l)
1.310 l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
1.311 -print len(l) == 10, len(l)
1.312 -print l[0] == (1997, 9, 30, 9, 0, 0), l[0]
1.313 -print l[-1] == (1998, 2, 1, 9, 0, 0), l[-1]
1.314 +print len(l) == 10, 10, len(l)
1.315 +print l[0] == (1997, 9, 30, 9, 0, 0), (1997, 9, 30, 9, 0, 0), l[0]
1.316 +print l[-1] == (1998, 2, 1, 9, 0, 0), (1998, 2, 1, 9, 0, 0), l[-1]
1.317 print
1.318
1.319 qualifiers = [
1.320 @@ -477,9 +477,9 @@
1.321
1.322 s = process(l)
1.323 l = s.materialise(dt, (1999, 12, 24, 0, 0, 0), 10)
1.324 -print len(l) == 10, len(l)
1.325 -print l[0] == (1997, 9, 10, 9, 0, 0), l[0]
1.326 -print l[-1] == (1999, 3, 13, 9, 0, 0), l[-1]
1.327 +print len(l) == 10, 10, len(l)
1.328 +print l[0] == (1997, 9, 10, 9, 0, 0), (1997, 9, 10, 9, 0, 0), l[0]
1.329 +print l[-1] == (1999, 3, 13, 9, 0, 0), (1999, 3, 13, 9, 0, 0), l[-1]
1.330 print
1.331
1.332 qualifiers = [
1.333 @@ -497,9 +497,9 @@
1.334
1.335 s = process(l)
1.336 l = s.materialise(dt, (1998, 4, 1, 0, 0, 0))
1.337 -print len(l) == 18, len(l)
1.338 -print l[0] == (1997, 9, 2, 9, 0, 0), l[0]
1.339 -print l[-1] == (1998, 3, 31, 9, 0, 0), l[-1]
1.340 +print len(l) == 18, 18, len(l)
1.341 +print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
1.342 +print l[-1] == (1998, 3, 31, 9, 0, 0), (1998, 3, 31, 9, 0, 0), l[-1]
1.343 print
1.344
1.345 qualifiers = [
1.346 @@ -517,9 +517,9 @@
1.347
1.348 s = process(l)
1.349 l = s.materialise(dt, (2001, 12, 24, 0, 0, 0), 10)
1.350 -print len(l) == 10, len(l)
1.351 -print l[0] == (1997, 6, 10, 9, 0, 0), l[0]
1.352 -print l[-1] == (2001, 7, 10, 9, 0, 0), l[-1]
1.353 +print len(l) == 10, 10, len(l)
1.354 +print l[0] == (1997, 6, 10, 9, 0, 0), (1997, 6, 10, 9, 0, 0), l[0]
1.355 +print l[-1] == (2001, 7, 10, 9, 0, 0), (2001, 7, 10, 9, 0, 0), l[-1]
1.356 print
1.357
1.358 qualifiers = [
1.359 @@ -537,9 +537,9 @@
1.360
1.361 s = process(l)
1.362 l = s.materialise(dt, (2003, 12, 24, 0, 0, 0), 10)
1.363 -print len(l) == 10, len(l)
1.364 -print l[0] == (1997, 3, 10, 9, 0, 0), l[0]
1.365 -print l[-1] == (2003, 3, 10, 9, 0, 0), l[-1]
1.366 +print len(l) == 10, 10, len(l)
1.367 +print l[0] == (1997, 3, 10, 9, 0, 0), (1997, 3, 10, 9, 0, 0), l[0]
1.368 +print l[-1] == (2003, 3, 10, 9, 0, 0), (2003, 3, 10, 9, 0, 0), l[-1]
1.369 print
1.370
1.371 qualifiers = [
1.372 @@ -557,9 +557,29 @@
1.373
1.374 s = process(l)
1.375 l = s.materialise(dt, (2006, 2, 1, 0, 0, 0), 10)
1.376 -print len(l) == 10, len(l)
1.377 -print l[0] == (1997, 1, 1, 9, 0, 0), l[0]
1.378 -print l[-1] == (2006, 1, 1, 9, 0, 0), l[-1]
1.379 +print len(l) == 10, 10, len(l)
1.380 +print l[0] == (1997, 1, 1, 9, 0, 0), (1997, 1, 1, 9, 0, 0), l[0]
1.381 +print l[-1] == (2006, 1, 1, 9, 0, 0), (2006, 1, 1, 9, 0, 0), l[-1]
1.382 +print
1.383 +
1.384 +qualifiers = [
1.385 + ("YEARLY", {"interval" : 1}),
1.386 + ("BYDAY", {"values" : [(1, 20)]})
1.387 + ]
1.388 +
1.389 +l = order_qualifiers(qualifiers)
1.390 +show(l)
1.391 +dt = (1997, 5, 19, 9, 0, 0)
1.392 +l = get_datetime_structure(dt)
1.393 +show(l)
1.394 +l = combine_datetime_with_qualifiers(dt, qualifiers)
1.395 +show(l)
1.396 +
1.397 +s = process(l)
1.398 +l = s.materialise(dt, (1999, 12, 24, 0, 0, 0))
1.399 +print len(l) == 3, 3, len(l)
1.400 +print l[0] == (1997, 5, 19, 9, 0, 0), (1997, 5, 19, 9, 0, 0), l[0]
1.401 +print l[-1] == (1999, 5, 17, 9, 0, 0), (1999, 5, 17, 9, 0, 0), l[-1]
1.402 print
1.403
1.404 # vim: tabstop=4 expandtab shiftwidth=4