imip-agent

Annotated tests/qualifiers.py

496:b59babfd290d
2015-04-06 Paul Boddie Fixed empty attendee removal; removed superfluous position information from the attendee-adding control elements; removed a superfluous time zone lookup.
paul@33 1
#!/usr/bin/env python
paul@33 2
paul@33 3
from vRecurrence import *
paul@33 4
paul@33 5
def show(l):
paul@33 6
    for x in l:
paul@33 7
        print x
paul@33 8
    print
paul@33 9
paul@33 10
qualifiers = [
paul@33 11
    ("YEARLY", {"interval" : 1})
paul@33 12
    ]
paul@33 13
paul@33 14
l = order_qualifiers(qualifiers)
paul@33 15
show(l)
paul@33 16
dt = (1997, 11, 2)
paul@33 17
l = get_datetime_structure(dt)
paul@33 18
show(l)
paul@33 19
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 20
show(l)
paul@33 21
paul@46 22
s = get_selector(dt, qualifiers)
paul@35 23
l = s.materialise(dt, (2003, 12, 24))
paul@39 24
print len(l) == 7, 7, len(l)
paul@39 25
print l[0] == (1997, 11, 2), (1997, 11, 2), l[0]
paul@39 26
print l[-1] == (2003, 11, 2), (2003, 11, 2), l[-1]
paul@33 27
print
paul@33 28
paul@33 29
qualifiers = [
paul@33 30
    ("YEARLY", {"interval" : 2}),
paul@33 31
    ("BYMONTH", {"values" : [1]}),
paul@34 32
    ("BYDAY", {"values" : [(6, None)]}),
paul@33 33
    ("BYHOUR", {"values" : [8, 9]}),
paul@33 34
    ("BYMINUTE", {"values" : [30]})
paul@33 35
    ]
paul@33 36
paul@33 37
l = order_qualifiers(qualifiers)
paul@33 38
show(l)
paul@33 39
dt = (1997, 1, 5, 8, 30, 0)
paul@33 40
l = get_datetime_structure(dt)
paul@33 41
show(l)
paul@33 42
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 43
show(l)
paul@33 44
paul@46 45
s = get_selector(dt, qualifiers)
paul@35 46
l = s.materialise(dt, (2003, 12, 24, 0, 0, 0))
paul@39 47
print len(l) == 32, 32, len(l)
paul@39 48
print l[0] == (1997, 1, 11, 8, 30, 0), (1997, 1, 11, 8, 30, 0), l[0]
paul@39 49
print l[-1] == (2003, 1, 25, 9, 30, 0), (2003, 1, 25, 9, 30, 0), l[-1]
paul@33 50
print
paul@33 51
paul@33 52
qualifiers = [
paul@33 53
    ("DAILY", {"interval" : 1})
paul@33 54
    ]
paul@33 55
paul@33 56
l = order_qualifiers(qualifiers)
paul@33 57
show(l)
paul@33 58
dt = (1997, 9, 2, 9, 0, 0)
paul@33 59
l = get_datetime_structure(dt)
paul@33 60
show(l)
paul@33 61
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 62
show(l)
paul@33 63
paul@46 64
s = get_selector(dt, qualifiers)
paul@35 65
l = s.materialise(dt, (1997, 12, 24), 10)
paul@39 66
print len(l) == 10, 10, len(l)
paul@39 67
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 68
print l[-1] == (1997, 9, 11, 9, 0, 0), (1997, 9, 11, 9, 0, 0), l[-1]
paul@33 69
print
paul@33 70
paul@33 71
qualifiers = [
paul@33 72
    ("DAILY", {"interval" : 1})
paul@33 73
    ]
paul@33 74
paul@33 75
l = order_qualifiers(qualifiers)
paul@33 76
show(l)
paul@33 77
dt = (1997, 9, 2, 9, 0, 0)
paul@33 78
l = get_datetime_structure(dt)
paul@33 79
show(l)
paul@33 80
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 81
show(l)
paul@33 82
paul@46 83
s = get_selector(dt, qualifiers)
paul@35 84
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
paul@39 85
print len(l) == 113, 113, len(l)
paul@39 86
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 87
print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
paul@33 88
print
paul@33 89
paul@33 90
qualifiers = [
paul@33 91
    ("DAILY", {"interval" : 2})
paul@33 92
    ]
paul@33 93
paul@33 94
l = order_qualifiers(qualifiers)
paul@33 95
show(l)
paul@33 96
dt = (1997, 9, 2, 9, 0, 0)
paul@33 97
l = get_datetime_structure(dt)
paul@33 98
show(l)
paul@33 99
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 100
show(l)
paul@33 101
paul@46 102
s = get_selector(dt, qualifiers)
paul@35 103
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
paul@39 104
print len(l) == 57, 57, len(l)
paul@39 105
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 106
print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
paul@33 107
print
paul@33 108
paul@33 109
qualifiers = [
paul@33 110
    ("WEEKLY", {"interval" : 1})
paul@33 111
    ]
paul@33 112
paul@33 113
l = order_qualifiers(qualifiers)
paul@33 114
show(l)
paul@33 115
dt = (1997, 9, 2, 9, 0, 0)
paul@33 116
l = get_datetime_structure(dt)
paul@33 117
show(l)
paul@33 118
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 119
show(l)
paul@33 120
paul@46 121
s = get_selector(dt, qualifiers)
paul@35 122
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
paul@39 123
print len(l) == 17, 17, len(l)
paul@39 124
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 125
print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
paul@33 126
print
paul@33 127
paul@33 128
qualifiers = [
paul@33 129
    ("DAILY", {"interval" : 10})
paul@33 130
    ]
paul@33 131
paul@33 132
l = order_qualifiers(qualifiers)
paul@33 133
show(l)
paul@33 134
dt = (1997, 9, 2, 9, 0, 0)
paul@33 135
l = get_datetime_structure(dt)
paul@33 136
show(l)
paul@33 137
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 138
show(l)
paul@33 139
paul@46 140
s = get_selector(dt, qualifiers)
paul@35 141
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 5)
paul@39 142
print len(l) == 5, 5, len(l)
paul@39 143
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 144
print l[-1] == (1997, 10, 12, 9, 0, 0), (1997, 10, 12, 9, 0, 0), l[-1]
paul@33 145
print
paul@33 146
paul@33 147
qualifiers = [
paul@33 148
    ("YEARLY", {"interval" : 1}),
paul@33 149
    ("BYMONTH", {"values" : [1]}),
paul@34 150
    ("BYDAY", {"values" : [(1, None), (2, None), (3, None), (4, None), (5, None), (6, None), (7, None)]})
paul@33 151
    ]
paul@33 152
paul@33 153
l = order_qualifiers(qualifiers)
paul@33 154
show(l)
paul@33 155
dt = (1998, 1, 1, 9, 0, 0)
paul@33 156
l = get_datetime_structure(dt)
paul@33 157
show(l)
paul@33 158
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 159
show(l)
paul@33 160
paul@46 161
s = get_selector(dt, qualifiers)
paul@35 162
l = s.materialise(dt, (2000, 1, 31, 14, 0, 0))
paul@39 163
print len(l) == 93, 93, len(l)
paul@39 164
print l[0] == (1998, 1, 1, 9, 0, 0), (1998, 1, 1, 9, 0, 0), l[0]
paul@39 165
print l[-1] == (2000, 1, 31, 9, 0, 0), (2000, 1, 31, 9, 0, 0), l[-1]
paul@33 166
print
paul@33 167
paul@33 168
qualifiers = [
paul@33 169
    ("DAILY", {"interval" : 1}),
paul@33 170
    ("BYMONTH", {"values" : [1]})
paul@33 171
    ]
paul@33 172
paul@33 173
l = order_qualifiers(qualifiers)
paul@33 174
show(l)
paul@33 175
dt = (1998, 1, 1, 9, 0, 0)
paul@33 176
l = get_datetime_structure(dt)
paul@33 177
show(l)
paul@33 178
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 179
show(l)
paul@33 180
paul@46 181
s = get_selector(dt, qualifiers)
paul@35 182
l = s.materialise(dt, (2000, 1, 31, 14, 0, 0))
paul@39 183
print len(l) == 93, 93, len(l)
paul@39 184
print l[0] == (1998, 1, 1, 9, 0, 0), (1998, 1, 1, 9, 0, 0), l[0]
paul@39 185
print l[-1] == (2000, 1, 31, 9, 0, 0), (2000, 1, 31, 9, 0, 0), l[-1]
paul@33 186
print
paul@33 187
paul@33 188
qualifiers = [
paul@33 189
    ("WEEKLY", {"interval" : 1})
paul@33 190
    ]
paul@33 191
paul@33 192
l = order_qualifiers(qualifiers)
paul@33 193
show(l)
paul@33 194
dt = (1997, 9, 2, 9, 0, 0)
paul@33 195
l = get_datetime_structure(dt)
paul@33 196
show(l)
paul@33 197
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 198
show(l)
paul@33 199
paul@46 200
s = get_selector(dt, qualifiers)
paul@35 201
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 10)
paul@39 202
print len(l) == 10, 10, len(l)
paul@39 203
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 204
print l[-1] == (1997, 11, 4, 9, 0, 0), (1997, 11, 4, 9, 0, 0), l[-1]
paul@33 205
print
paul@33 206
paul@33 207
qualifiers = [
paul@33 208
    ("WEEKLY", {"interval" : 1})
paul@33 209
    ]
paul@33 210
paul@33 211
l = order_qualifiers(qualifiers)
paul@33 212
show(l)
paul@33 213
dt = (1997, 9, 2, 9, 0, 0)
paul@33 214
l = get_datetime_structure(dt)
paul@33 215
show(l)
paul@33 216
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 217
show(l)
paul@33 218
paul@46 219
s = get_selector(dt, qualifiers)
paul@35 220
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
paul@39 221
print len(l) == 17, 17, len(l)
paul@39 222
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 223
print l[-1] == (1997, 12, 23, 9, 0, 0), (1997, 12, 23, 9, 0, 0), l[-1]
paul@33 224
print
paul@33 225
paul@33 226
qualifiers = [
paul@33 227
    ("WEEKLY", {"interval" : 2})
paul@33 228
    ]
paul@33 229
paul@33 230
l = order_qualifiers(qualifiers)
paul@33 231
show(l)
paul@33 232
dt = (1997, 9, 2, 9, 0, 0)
paul@33 233
l = get_datetime_structure(dt)
paul@33 234
show(l)
paul@33 235
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 236
show(l)
paul@33 237
paul@46 238
s = get_selector(dt, qualifiers)
paul@35 239
l = s.materialise(dt, (1998, 2, 20, 0, 0, 0))
paul@39 240
print len(l) == 13, 13, len(l)
paul@39 241
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 242
print l[-1] == (1998, 2, 17, 9, 0, 0), (1998, 2, 17, 9, 0, 0), l[-1]
paul@33 243
print
paul@33 244
paul@33 245
qualifiers = [
paul@33 246
    ("WEEKLY", {"interval" : 1}),
paul@34 247
    ("BYDAY", {"values" : [(2, None), (4, None)]})
paul@33 248
    ]
paul@33 249
paul@33 250
l = order_qualifiers(qualifiers)
paul@33 251
show(l)
paul@33 252
dt = (1997, 9, 2, 9, 0, 0)
paul@33 253
l = get_datetime_structure(dt)
paul@33 254
show(l)
paul@33 255
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 256
show(l)
paul@33 257
paul@46 258
s = get_selector(dt, qualifiers)
paul@35 259
l = s.materialise(dt, (1997, 10, 7, 9, 0, 0))
paul@39 260
print len(l) == 10, 10, len(l)
paul@39 261
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 262
print l[-1] == (1997, 10, 2, 9, 0, 0), (1997, 10, 2, 9, 0, 0), l[-1]
paul@33 263
print
paul@33 264
paul@33 265
qualifiers = [
paul@33 266
    ("WEEKLY", {"interval" : 1}),
paul@34 267
    ("BYDAY", {"values" : [(2, None), (4, None)]})
paul@33 268
    ]
paul@33 269
paul@33 270
l = order_qualifiers(qualifiers)
paul@33 271
show(l)
paul@33 272
dt = (1997, 9, 2, 9, 0, 0)
paul@33 273
l = get_datetime_structure(dt)
paul@33 274
show(l)
paul@33 275
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 276
show(l)
paul@33 277
paul@46 278
s = get_selector(dt, qualifiers)
paul@35 279
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 10)
paul@39 280
print len(l) == 10, 10, len(l)
paul@39 281
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 282
print l[-1] == (1997, 10, 2, 9, 0, 0), (1997, 10, 2, 9, 0, 0), l[-1]
paul@33 283
print
paul@33 284
paul@33 285
qualifiers = [
paul@33 286
    ("WEEKLY", {"interval" : 2}),
paul@34 287
    ("BYDAY", {"values" : [(1, None), (3, None), (5, None)]})
paul@33 288
    ]
paul@33 289
paul@33 290
l = order_qualifiers(qualifiers)
paul@33 291
show(l)
paul@33 292
dt = (1997, 9, 1, 9, 0, 0)
paul@33 293
l = get_datetime_structure(dt)
paul@33 294
show(l)
paul@33 295
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@33 296
show(l)
paul@33 297
paul@46 298
s = get_selector(dt, qualifiers)
paul@35 299
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
paul@39 300
print len(l) == 25, 25, len(l)
paul@39 301
print l[0] == (1997, 9, 1, 9, 0, 0), (1997, 9, 1, 9, 0, 0), l[0]
paul@39 302
print l[-1] == (1997, 12, 22, 9, 0, 0), (1997, 12, 22, 9, 0, 0), l[-1]
paul@33 303
print
paul@33 304
paul@34 305
qualifiers = [
paul@34 306
    ("WEEKLY", {"interval" : 2}),
paul@34 307
    ("BYDAY", {"values" : [(2, None), (4, None)]})
paul@34 308
    ]
paul@34 309
paul@34 310
l = order_qualifiers(qualifiers)
paul@34 311
show(l)
paul@34 312
dt = (1997, 9, 2, 9, 0, 0)
paul@34 313
l = get_datetime_structure(dt)
paul@34 314
show(l)
paul@34 315
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@34 316
show(l)
paul@34 317
paul@46 318
s = get_selector(dt, qualifiers)
paul@35 319
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 8)
paul@39 320
print len(l) == 8, 8, len(l)
paul@39 321
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 322
print l[-1] == (1997, 10, 16, 9, 0, 0), (1997, 10, 16, 9, 0, 0), l[-1]
paul@34 323
print
paul@34 324
paul@34 325
qualifiers = [
paul@34 326
    ("MONTHLY", {"interval" : 1}),
paul@39 327
    ("BYDAY", {"values" : [(5, 1)]})
paul@34 328
    ]
paul@34 329
paul@34 330
l = order_qualifiers(qualifiers)
paul@34 331
show(l)
paul@34 332
dt = (1997, 9, 5, 9, 0, 0)
paul@34 333
l = get_datetime_structure(dt)
paul@34 334
show(l)
paul@34 335
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@34 336
show(l)
paul@34 337
paul@46 338
s = get_selector(dt, qualifiers)
paul@35 339
l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
paul@39 340
print len(l) == 10, 10, len(l)
paul@39 341
print l[0] == (1997, 9, 5, 9, 0, 0), (1997, 9, 5, 9, 0, 0), l[0]
paul@39 342
print l[-1] == (1998, 6, 5, 9, 0, 0), (1998, 6, 5, 9, 0, 0), l[-1]
paul@34 343
print
paul@34 344
paul@34 345
qualifiers = [
paul@34 346
    ("MONTHLY", {"interval" : 1}),
paul@39 347
    ("BYDAY", {"values" : [(5, 1)]})
paul@34 348
    ]
paul@34 349
paul@34 350
l = order_qualifiers(qualifiers)
paul@34 351
show(l)
paul@34 352
dt = (1997, 9, 5, 9, 0, 0)
paul@34 353
l = get_datetime_structure(dt)
paul@34 354
show(l)
paul@34 355
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@34 356
show(l)
paul@34 357
paul@46 358
s = get_selector(dt, qualifiers)
paul@35 359
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0))
paul@39 360
print len(l) == 4, 4, len(l)
paul@39 361
print l[0] == (1997, 9, 5, 9, 0, 0), (1997, 9, 5, 9, 0, 0), l[0]
paul@39 362
print l[-1] == (1997, 12, 5, 9, 0, 0), (1997, 12, 5, 9, 0, 0), l[-1]
paul@34 363
print
paul@34 364
paul@34 365
qualifiers = [
paul@34 366
    ("MONTHLY", {"interval" : 2}),
paul@39 367
    ("BYDAY", {"values" : [(7, 1), (7, -1)]})
paul@34 368
    ]
paul@34 369
paul@34 370
l = order_qualifiers(qualifiers)
paul@34 371
show(l)
paul@34 372
dt = (1997, 9, 7, 9, 0, 0)
paul@34 373
l = get_datetime_structure(dt)
paul@34 374
show(l)
paul@34 375
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@34 376
show(l)
paul@34 377
paul@46 378
s = get_selector(dt, qualifiers)
paul@35 379
l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
paul@39 380
print len(l) == 10, 10, len(l)
paul@39 381
print l[0] == (1997, 9, 7, 9, 0, 0), (1997, 9, 7, 9, 0, 0), l[0]
paul@39 382
print l[-1] == (1998, 5, 31, 9, 0, 0), (1998, 5, 31, 9, 0, 0), l[-1]
paul@34 383
print
paul@34 384
paul@34 385
qualifiers = [
paul@34 386
    ("MONTHLY", {"interval" : 1}),
paul@34 387
    ("BYDAY", {"values" : [(1, -2)]})
paul@34 388
    ]
paul@34 389
paul@34 390
l = order_qualifiers(qualifiers)
paul@34 391
show(l)
paul@34 392
dt = (1997, 9, 22, 9, 0, 0)
paul@34 393
l = get_datetime_structure(dt)
paul@34 394
show(l)
paul@34 395
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@34 396
show(l)
paul@34 397
paul@46 398
s = get_selector(dt, qualifiers)
paul@35 399
l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 6)
paul@39 400
print len(l) == 6, 6, len(l)
paul@39 401
print l[0] == (1997, 9, 22, 9, 0, 0), (1997, 9, 22, 9, 0, 0), l[0]
paul@39 402
print l[-1] == (1998, 2, 16, 9, 0, 0), (1998, 2, 16, 9, 0, 0), l[-1]
paul@34 403
print
paul@34 404
paul@35 405
qualifiers = [
paul@35 406
    ("MONTHLY", {"interval" : 1}),
paul@35 407
    ("BYMONTHDAY", {"values" : [-3]})
paul@35 408
    ]
paul@35 409
paul@35 410
l = order_qualifiers(qualifiers)
paul@35 411
show(l)
paul@35 412
dt = (1997, 9, 28, 9, 0, 0)
paul@35 413
l = get_datetime_structure(dt)
paul@35 414
show(l)
paul@35 415
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@35 416
show(l)
paul@35 417
paul@46 418
s = get_selector(dt, qualifiers)
paul@35 419
l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 6)
paul@39 420
print len(l) == 6, 6, len(l)
paul@39 421
print l[0] == (1997, 9, 28, 9, 0, 0), (1997, 9, 28, 9, 0, 0), l[0]
paul@39 422
print l[-1] == (1998, 2, 26, 9, 0, 0), (1998, 2, 26, 9, 0, 0), l[-1]
paul@35 423
print
paul@35 424
paul@35 425
qualifiers = [
paul@35 426
    ("MONTHLY", {"interval" : 1}),
paul@35 427
    ("BYMONTHDAY", {"values" : [2, 15]})
paul@35 428
    ]
paul@35 429
paul@35 430
l = order_qualifiers(qualifiers)
paul@35 431
show(l)
paul@35 432
dt = (1997, 9, 2, 9, 0, 0)
paul@35 433
l = get_datetime_structure(dt)
paul@35 434
show(l)
paul@35 435
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@35 436
show(l)
paul@35 437
paul@46 438
s = get_selector(dt, qualifiers)
paul@35 439
l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
paul@39 440
print len(l) == 10, 10, len(l)
paul@39 441
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 442
print l[-1] == (1998, 1, 15, 9, 0, 0), (1998, 1, 15, 9, 0, 0), l[-1]
paul@35 443
print
paul@35 444
paul@35 445
qualifiers = [
paul@35 446
    ("MONTHLY", {"interval" : 1}),
paul@35 447
    ("BYMONTHDAY", {"values" : [1, -1]})
paul@35 448
    ]
paul@35 449
paul@35 450
l = order_qualifiers(qualifiers)
paul@35 451
show(l)
paul@35 452
dt = (1997, 9, 30, 9, 0, 0)
paul@35 453
l = get_datetime_structure(dt)
paul@35 454
show(l)
paul@35 455
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@35 456
show(l)
paul@35 457
paul@46 458
s = get_selector(dt, qualifiers)
paul@35 459
l = s.materialise(dt, (1998, 12, 24, 0, 0, 0), 10)
paul@39 460
print len(l) == 10, 10, len(l)
paul@39 461
print l[0] == (1997, 9, 30, 9, 0, 0), (1997, 9, 30, 9, 0, 0), l[0]
paul@39 462
print l[-1] == (1998, 2, 1, 9, 0, 0), (1998, 2, 1, 9, 0, 0), l[-1]
paul@35 463
print
paul@35 464
paul@36 465
qualifiers = [
paul@36 466
    ("MONTHLY", {"interval" : 18}),
paul@36 467
    ("BYMONTHDAY", {"values" : [10, 11, 12, 13, 14, 15]})
paul@36 468
    ]
paul@36 469
paul@36 470
l = order_qualifiers(qualifiers)
paul@36 471
show(l)
paul@36 472
dt = (1997, 9, 10, 9, 0, 0)
paul@36 473
l = get_datetime_structure(dt)
paul@36 474
show(l)
paul@36 475
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@36 476
show(l)
paul@36 477
paul@46 478
s = get_selector(dt, qualifiers)
paul@36 479
l = s.materialise(dt, (1999, 12, 24, 0, 0, 0), 10)
paul@39 480
print len(l) == 10, 10, len(l)
paul@39 481
print l[0] == (1997, 9, 10, 9, 0, 0), (1997, 9, 10, 9, 0, 0), l[0]
paul@39 482
print l[-1] == (1999, 3, 13, 9, 0, 0), (1999, 3, 13, 9, 0, 0), l[-1]
paul@36 483
print
paul@36 484
paul@36 485
qualifiers = [
paul@36 486
    ("MONTHLY", {"interval" : 2}),
paul@36 487
    ("BYDAY", {"values" : [(2, None)]})
paul@36 488
    ]
paul@36 489
paul@36 490
l = order_qualifiers(qualifiers)
paul@36 491
show(l)
paul@36 492
dt = (1997, 9, 2, 9, 0, 0)
paul@36 493
l = get_datetime_structure(dt)
paul@36 494
show(l)
paul@36 495
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@36 496
show(l)
paul@36 497
paul@46 498
s = get_selector(dt, qualifiers)
paul@36 499
l = s.materialise(dt, (1998, 4, 1, 0, 0, 0))
paul@39 500
print len(l) == 18, 18, len(l)
paul@39 501
print l[0] == (1997, 9, 2, 9, 0, 0), (1997, 9, 2, 9, 0, 0), l[0]
paul@39 502
print l[-1] == (1998, 3, 31, 9, 0, 0), (1998, 3, 31, 9, 0, 0), l[-1]
paul@36 503
print
paul@36 504
paul@36 505
qualifiers = [
paul@36 506
    ("YEARLY", {"interval" : 1}),
paul@36 507
    ("BYMONTH", {"values" : [6, 7]})
paul@36 508
    ]
paul@36 509
paul@36 510
l = order_qualifiers(qualifiers)
paul@36 511
show(l)
paul@36 512
dt = (1997, 6, 10, 9, 0, 0)
paul@36 513
l = get_datetime_structure(dt)
paul@36 514
show(l)
paul@36 515
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@36 516
show(l)
paul@36 517
paul@46 518
s = get_selector(dt, qualifiers)
paul@36 519
l = s.materialise(dt, (2001, 12, 24, 0, 0, 0), 10)
paul@39 520
print len(l) == 10, 10, len(l)
paul@39 521
print l[0] == (1997, 6, 10, 9, 0, 0), (1997, 6, 10, 9, 0, 0), l[0]
paul@39 522
print l[-1] == (2001, 7, 10, 9, 0, 0), (2001, 7, 10, 9, 0, 0), l[-1]
paul@36 523
print
paul@36 524
paul@36 525
qualifiers = [
paul@36 526
    ("YEARLY", {"interval" : 2}),
paul@36 527
    ("BYMONTH", {"values" : [1, 2, 3]})
paul@36 528
    ]
paul@36 529
paul@36 530
l = order_qualifiers(qualifiers)
paul@36 531
show(l)
paul@36 532
dt = (1997, 3, 10, 9, 0, 0)
paul@36 533
l = get_datetime_structure(dt)
paul@36 534
show(l)
paul@36 535
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@36 536
show(l)
paul@36 537
paul@46 538
s = get_selector(dt, qualifiers)
paul@36 539
l = s.materialise(dt, (2003, 12, 24, 0, 0, 0), 10)
paul@39 540
print len(l) == 10, 10, len(l)
paul@39 541
print l[0] == (1997, 3, 10, 9, 0, 0), (1997, 3, 10, 9, 0, 0), l[0]
paul@39 542
print l[-1] == (2003, 3, 10, 9, 0, 0), (2003, 3, 10, 9, 0, 0), l[-1]
paul@36 543
print
paul@36 544
paul@37 545
qualifiers = [
paul@37 546
    ("YEARLY", {"interval" : 3}),
paul@37 547
    ("BYYEARDAY", {"values" : [1, 100, 200]})
paul@37 548
    ]
paul@37 549
paul@37 550
l = order_qualifiers(qualifiers)
paul@37 551
show(l)
paul@37 552
dt = (1997, 1, 1, 9, 0, 0)
paul@37 553
l = get_datetime_structure(dt)
paul@37 554
show(l)
paul@37 555
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@37 556
show(l)
paul@37 557
paul@46 558
s = get_selector(dt, qualifiers)
paul@37 559
l = s.materialise(dt, (2006, 2, 1, 0, 0, 0), 10)
paul@39 560
print len(l) == 10, 10, len(l)
paul@39 561
print l[0] == (1997, 1, 1, 9, 0, 0), (1997, 1, 1, 9, 0, 0), l[0]
paul@39 562
print l[-1] == (2006, 1, 1, 9, 0, 0), (2006, 1, 1, 9, 0, 0), l[-1]
paul@39 563
print
paul@39 564
paul@39 565
qualifiers = [
paul@39 566
    ("YEARLY", {"interval" : 1}),
paul@39 567
    ("BYDAY", {"values" : [(1, 20)]})
paul@39 568
    ]
paul@39 569
paul@39 570
l = order_qualifiers(qualifiers)
paul@39 571
show(l)
paul@39 572
dt = (1997, 5, 19, 9, 0, 0)
paul@39 573
l = get_datetime_structure(dt)
paul@39 574
show(l)
paul@39 575
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@39 576
show(l)
paul@39 577
paul@46 578
s = get_selector(dt, qualifiers)
paul@39 579
l = s.materialise(dt, (1999, 12, 24, 0, 0, 0))
paul@39 580
print len(l) == 3, 3, len(l)
paul@39 581
print l[0] == (1997, 5, 19, 9, 0, 0), (1997, 5, 19, 9, 0, 0), l[0]
paul@39 582
print l[-1] == (1999, 5, 17, 9, 0, 0), (1999, 5, 17, 9, 0, 0), l[-1]
paul@37 583
print
paul@37 584
paul@40 585
"""
paul@40 586
qualifiers = [
paul@40 587
    ("YEARLY", {"interval" : 1}),
paul@40 588
    ("BYWEEKNO", {"values" : [20]}),
paul@40 589
    ("BYDAY", {"values" : [(1, None)]})
paul@40 590
    ]
paul@40 591
paul@40 592
l = order_qualifiers(qualifiers)
paul@40 593
show(l)
paul@40 594
dt = (1997, 5, 12, 9, 0, 0)
paul@40 595
l = get_datetime_structure(dt)
paul@40 596
show(l)
paul@40 597
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@40 598
show(l)
paul@40 599
paul@46 600
s = get_selector(dt, qualifiers)
paul@40 601
l = s.materialise(dt, (1999, 12, 24, 0, 0, 0))
paul@40 602
print len(l) == 3, 3, len(l)
paul@40 603
print l[0] == (1997, 5, 12, 9, 0, 0), (1997, 5, 12, 9, 0, 0), l[0]
paul@40 604
print l[-1] == (1999, 5, 17, 9, 0, 0), (1999, 5, 17, 9, 0, 0), l[-1]
paul@40 605
print
paul@40 606
"""
paul@40 607
paul@40 608
qualifiers = [
paul@40 609
    ("YEARLY", {"interval" : 1}),
paul@40 610
    ("BYMONTH", {"values" : [3]}),
paul@40 611
    ("BYDAY", {"values" : [(4, None)]})
paul@40 612
    ]
paul@40 613
paul@40 614
l = order_qualifiers(qualifiers)
paul@40 615
show(l)
paul@40 616
dt = (1997, 3, 13, 9, 0, 0)
paul@40 617
l = get_datetime_structure(dt)
paul@40 618
show(l)
paul@40 619
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@40 620
show(l)
paul@40 621
paul@46 622
s = get_selector(dt, qualifiers)
paul@40 623
l = s.materialise(dt, (1999, 12, 24, 0, 0, 0))
paul@40 624
print len(l) == 11, 11, len(l)
paul@40 625
print l[0] == (1997, 3, 13, 9, 0, 0), (1997, 3, 13, 9, 0, 0), l[0]
paul@40 626
print l[-1] == (1999, 3, 25, 9, 0, 0), (1999, 3, 25, 9, 0, 0), l[-1]
paul@40 627
print
paul@40 628
paul@40 629
qualifiers = [
paul@40 630
    ("YEARLY", {"interval" : 1}),
paul@40 631
    ("BYMONTH", {"values" : [6, 7, 8]}),
paul@40 632
    ("BYDAY", {"values" : [(4, None)]})
paul@40 633
    ]
paul@40 634
paul@40 635
l = order_qualifiers(qualifiers)
paul@40 636
show(l)
paul@40 637
dt = (1997, 6, 5, 9, 0, 0)
paul@40 638
l = get_datetime_structure(dt)
paul@40 639
show(l)
paul@40 640
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@40 641
show(l)
paul@40 642
paul@46 643
s = get_selector(dt, qualifiers)
paul@40 644
l = s.materialise(dt, (1999, 12, 24, 0, 0, 0))
paul@40 645
print len(l) == 39, 39, len(l)
paul@40 646
print l[0] == (1997, 6, 5, 9, 0, 0), (1997, 6, 5, 9, 0, 0), l[0]
paul@40 647
print l[-1] == (1999, 8, 26, 9, 0, 0), (1999, 8, 26, 9, 0, 0), l[-1]
paul@40 648
print
paul@40 649
paul@40 650
qualifiers = [
paul@40 651
    ("MONTHLY", {"interval" : 1}),
paul@40 652
    ("BYMONTHDAY", {"values" : [13]}),
paul@40 653
    ("BYDAY", {"values" : [(5, None)]})
paul@40 654
    ]
paul@40 655
paul@40 656
l = order_qualifiers(qualifiers)
paul@40 657
show(l)
paul@40 658
dt = (1997, 9, 2, 9, 0, 0)
paul@40 659
l = get_datetime_structure(dt)
paul@40 660
show(l)
paul@40 661
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@40 662
show(l)
paul@40 663
paul@46 664
s = get_selector(dt, qualifiers)
paul@40 665
l = s.materialise(dt, (2000, 12, 24, 0, 0, 0))
paul@40 666
print len(l) == 5, 5, len(l)
paul@40 667
print l[0] == (1998, 2, 13, 9, 0, 0), (1998, 2, 13, 9, 0, 0), l[0]
paul@40 668
print l[-1] == (2000, 10, 13, 9, 0, 0), (2000, 10, 13, 9, 0, 0), l[-1]
paul@40 669
print
paul@40 670
paul@40 671
qualifiers = [
paul@40 672
    ("MONTHLY", {"interval" : 1}),
paul@40 673
    ("BYMONTHDAY", {"values" : [7, 8, 9, 10, 11, 12, 13]}),
paul@40 674
    ("BYDAY", {"values" : [(6, None)]})
paul@40 675
    ]
paul@40 676
paul@40 677
l = order_qualifiers(qualifiers)
paul@40 678
show(l)
paul@40 679
dt = (1997, 9, 13, 9, 0, 0)
paul@40 680
l = get_datetime_structure(dt)
paul@40 681
show(l)
paul@40 682
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@40 683
show(l)
paul@40 684
paul@46 685
s = get_selector(dt, qualifiers)
paul@40 686
l = s.materialise(dt, (1998, 6, 30, 0, 0, 0))
paul@40 687
print len(l) == 10, 10, len(l)
paul@40 688
print l[0] == (1997, 9, 13, 9, 0, 0), (1997, 9, 13, 9, 0, 0), l[0]
paul@40 689
print l[-1] == (1998, 6, 13, 9, 0, 0), (1998, 6, 13, 9, 0, 0), l[-1]
paul@40 690
print
paul@40 691
paul@40 692
qualifiers = [
paul@40 693
    ("YEARLY", {"interval" : 4}),
paul@40 694
    ("BYMONTH", {"values" : [11]}),
paul@40 695
    ("BYMONTHDAY", {"values" : [2, 3, 4, 5, 6, 7, 8]}),
paul@40 696
    ("BYDAY", {"values" : [(2, None)]})
paul@40 697
    ]
paul@40 698
paul@40 699
l = order_qualifiers(qualifiers)
paul@40 700
show(l)
paul@40 701
dt = (1996, 11, 5, 9, 0, 0)
paul@40 702
l = get_datetime_structure(dt)
paul@40 703
show(l)
paul@40 704
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@40 705
show(l)
paul@40 706
paul@46 707
s = get_selector(dt, qualifiers)
paul@40 708
l = s.materialise(dt, (2004, 12, 24, 0, 0, 0))
paul@40 709
print len(l) == 3, 3, len(l)
paul@40 710
print l[0] == (1996, 11, 5, 9, 0, 0), (1996, 11, 5, 9, 0, 0), l[0]
paul@40 711
print l[-1] == (2004, 11, 2, 9, 0, 0), (2004, 11, 2, 9, 0, 0), l[-1]
paul@40 712
print
paul@40 713
paul@45 714
qualifiers = [
paul@45 715
    ("MONTHLY", {"interval" : 1}),
paul@45 716
    ("BYDAY", {"values" : [(2, None), (3, None), (4, None)]})
paul@45 717
    ]
paul@45 718
paul@45 719
l = order_qualifiers(qualifiers)
paul@45 720
show(l)
paul@45 721
dt = (1997, 9, 4, 9, 0, 0)
paul@45 722
l = get_datetime_structure(dt)
paul@45 723
show(l)
paul@45 724
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@45 725
show(l)
paul@45 726
paul@46 727
s = get_selector(dt, qualifiers)
paul@45 728
l = s.materialise(dt, (1997, 12, 24, 0, 0, 0), 3, [3])
paul@45 729
print len(l) == 3, 3, len(l)
paul@45 730
print l[0] == (1997, 9, 4, 9, 0, 0), (1997, 9, 4, 9, 0, 0), l[0]
paul@45 731
print l[-1] == (1997, 11, 6, 9, 0, 0), (1997, 11, 6, 9, 0, 0), l[-1]
paul@45 732
print
paul@45 733
paul@45 734
l2 = l
paul@45 735
paul@45 736
qualifiers = [
paul@45 737
    ("MONTHLY", {"interval" : 1}),
paul@45 738
    ("BYDAY", {"values" : [(1, None), (2, None), (3, None), (4, None), (5, None)]})
paul@45 739
    ]
paul@45 740
paul@45 741
l = order_qualifiers(qualifiers)
paul@45 742
show(l)
paul@45 743
dt = (1997, 9, 29, 9, 0, 0)
paul@45 744
l = get_datetime_structure(dt)
paul@45 745
show(l)
paul@45 746
l = combine_datetime_with_qualifiers(dt, qualifiers)
paul@45 747
show(l)
paul@45 748
paul@46 749
s = get_selector(dt, qualifiers)
paul@45 750
l = s.materialise(dt, (1998, 4, 1, 0, 0, 0), None, [-2])
paul@45 751
print len(l) == 7, 7, len(l)
paul@45 752
print l[0] == (1997, 9, 29, 9, 0, 0), (1997, 9, 29, 9, 0, 0), l[0]
paul@45 753
print l[-1] == (1998, 3, 30, 9, 0, 0), (1998, 3, 30, 9, 0, 0), l[-1]
paul@45 754
print
paul@45 755
paul@33 756
# vim: tabstop=4 expandtab shiftwidth=4