holidays 7.0.0 → 8.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +5 -6
- data/doc/CONTRIBUTING.md +2 -1
- data/holidays.gemspec +5 -5
- data/lib/generated_definitions/MANIFEST +3 -0
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/au.rb +1 -1
- data/lib/generated_definitions/ca.rb +14 -12
- data/lib/generated_definitions/ch.rb +13 -1
- data/lib/generated_definitions/cl.rb +5 -5
- data/lib/generated_definitions/de.rb +6 -4
- data/lib/generated_definitions/es.rb +4 -2
- data/lib/generated_definitions/europe.rb +83 -22
- data/lib/generated_definitions/federalreservebanks.rb +1 -1
- data/lib/generated_definitions/gb.rb +6 -4
- data/lib/generated_definitions/hr.rb +8 -6
- data/lib/generated_definitions/hu.rb +3 -2
- data/lib/generated_definitions/it.rb +14 -5
- data/lib/generated_definitions/jp.rb +24 -20
- data/lib/generated_definitions/lu.rb +2 -0
- data/lib/generated_definitions/lv.rb +52 -0
- data/lib/generated_definitions/mx.rb +3 -3
- data/lib/generated_definitions/ng.rb +33 -0
- data/lib/generated_definitions/northamerica.rb +21 -20
- data/lib/generated_definitions/ro.rb +5 -2
- data/lib/generated_definitions/southamerica.rb +5 -5
- data/lib/generated_definitions/th.rb +36 -0
- data/lib/generated_definitions/tr.rb +5 -3
- data/lib/generated_definitions/ua.rb +6 -6
- data/lib/generated_definitions/us.rb +5 -6
- data/lib/holidays.rb +2 -0
- data/lib/holidays/definition/context/generator.rb +20 -34
- data/lib/holidays/definition/repository/holidays_by_month.rb +9 -1
- data/lib/holidays/finder/context/search.rb +34 -31
- data/lib/holidays/finder/rules/year_range.rb +30 -54
- data/lib/holidays/version.rb +1 -1
- data/test/coverage_report.rb +23 -5
- data/test/data/test_custom_year_range_holiday_defs.yaml +6 -10
- data/test/data/test_multiple_regions_with_conflicts_region_1.yaml +38 -0
- data/test/data/test_multiple_regions_with_conflicts_region_2.yaml +38 -0
- data/test/defs/test_defs_ca.rb +31 -1
- data/test/defs/test_defs_ch.rb +4 -0
- data/test/defs/test_defs_co.rb +3 -3
- data/test/defs/test_defs_de.rb +6 -0
- data/test/defs/test_defs_es.rb +2 -0
- data/test/defs/test_defs_europe.rb +160 -11
- data/test/defs/test_defs_federalreservebanks.rb +137 -3
- data/test/defs/test_defs_gb.rb +16 -0
- data/test/defs/test_defs_hr.rb +6 -6
- data/test/defs/test_defs_hu.rb +12 -4
- data/test/defs/test_defs_it.rb +20 -0
- data/test/defs/test_defs_lu.rb +6 -0
- data/test/defs/test_defs_lv.rb +90 -0
- data/test/defs/test_defs_ng.rb +29 -0
- data/test/defs/test_defs_northamerica.rb +37 -11
- data/test/defs/test_defs_ro.rb +14 -0
- data/test/defs/test_defs_southamerica.rb +3 -3
- data/test/defs/test_defs_th.rb +33 -0
- data/test/defs/test_defs_tr.rb +7 -0
- data/test/defs/test_defs_us.rb +6 -10
- data/test/holidays/core_extensions/test_date.rb +3 -2
- data/test/holidays/definition/context/test_generator.rb +5 -18
- data/test/holidays/definition/repository/test_holidays_by_month.rb +121 -1
- data/test/holidays/finder/rules/test_year_range.rb +43 -47
- data/test/integration/test_available_regions.rb +1 -1
- data/test/integration/test_custom_year_range_holidays.rb +0 -7
- data/test/integration/test_holidays.rb +1 -23
- data/test/integration/test_holidays_between.rb +10 -0
- data/test/integration/test_multiple_regions_with_conflict.rb +29 -0
- data/test/integration/test_nonstandard_regions.rb +1 -1
- metadata +27 -13
@@ -18,6 +18,6 @@ class AvailableRegionsTests < Test::Unit::TestCase
|
|
18
18
|
# This test might fail if we add new regions. Since this is an integration test
|
19
19
|
# I am fine with that!
|
20
20
|
def test_available_regions_returns_correct_number_of_regions
|
21
|
-
assert_equal
|
21
|
+
assert_equal 257, Holidays.available_regions.count
|
22
22
|
end
|
23
23
|
end
|
@@ -32,11 +32,4 @@ class CustomYearRangeHolidaysTest < Test::Unit::TestCase
|
|
32
32
|
assert_not_equal [], Holidays.on(Date.civil(2019,6,4), :custom_year_range_file)
|
33
33
|
assert_equal [], Holidays.on(Date.civil(2020,6,4), :custom_year_range_file)
|
34
34
|
end
|
35
|
-
|
36
|
-
def test_multiple_condition
|
37
|
-
Holidays.load_custom('test/data/test_custom_year_range_holiday_defs.yaml')
|
38
|
-
assert_not_equal [], Holidays.on(Date.civil(2015,6,5), :custom_year_range_file)
|
39
|
-
assert_equal [], Holidays.on(Date.civil(2016,6,5), :custom_year_range_file)
|
40
|
-
assert_not_equal [], Holidays.on(Date.civil(2017,6,5), :custom_year_range_file)
|
41
|
-
end
|
42
35
|
end
|
@@ -142,28 +142,6 @@ class HolidaysTests < Test::Unit::TestCase
|
|
142
142
|
assert_empty holidays
|
143
143
|
end
|
144
144
|
|
145
|
-
def test_year_holidays_feb_29_on_non_leap_year
|
146
|
-
assert_raises ArgumentError do
|
147
|
-
Holidays.year_holidays([:ca_on], Date.civil(2015, 2, 29))
|
148
|
-
end
|
149
|
-
|
150
|
-
assert_raises ArgumentError do
|
151
|
-
Holidays.year_holidays([:ca_on], Date.civil(2019, 2, 29))
|
152
|
-
end
|
153
|
-
|
154
|
-
assert_raises ArgumentError do
|
155
|
-
Holidays.year_holidays([:ca_on], Date.civil(2021, 2, 29))
|
156
|
-
end
|
157
|
-
|
158
|
-
assert_raises ArgumentError do
|
159
|
-
Holidays.year_holidays([:us], Date.civil(2023, 2, 29))
|
160
|
-
end
|
161
|
-
|
162
|
-
assert_raises ArgumentError do
|
163
|
-
Holidays.year_holidays([:ca_on], Date.civil(2025, 2, 29))
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
145
|
def test_year_holidays_random_years
|
168
146
|
# Should be 1 less holiday, as Family day didn't exist in Ontario in 1990
|
169
147
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(1990, 1, 1))
|
@@ -266,6 +244,6 @@ class HolidaysTests < Test::Unit::TestCase
|
|
266
244
|
|
267
245
|
def test_load_all
|
268
246
|
Holidays.load_all
|
269
|
-
assert_equal
|
247
|
+
assert_equal 257, Holidays.available_regions.count
|
270
248
|
end
|
271
249
|
end
|
@@ -41,6 +41,16 @@ class HolidaysBetweenTests < Test::Unit::TestCase
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_between_raises_error_if_end_date_is_before_start_date
|
45
|
+
assert_raise ArgumentError do
|
46
|
+
@subject.call(Date.civil(2019, 2, 1), Date.civil(2019, 1, 1), :us)
|
47
|
+
end
|
48
|
+
|
49
|
+
assert_raise ArgumentError do
|
50
|
+
@subject.call(Date.civil(2008,7,2), Date.civil(2000,7,2), :ca)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
44
54
|
def test_cached_holidays_are_returned_if_present
|
45
55
|
start_date = Date.civil(2015, 1, 1)
|
46
56
|
end_date = Date.civil(2015, 1, 31)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
2
|
+
|
3
|
+
# See https://github.com/holidays/holidays/issues/344 for more info on why
|
4
|
+
# these tests exist.
|
5
|
+
class MultipleRegionsWithConflictsTests < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_corpus_christi_returns_correctly_for_co_even_if_br_is_loaded_first
|
8
|
+
result = Holidays.on(Date.new(2014, 6, 19), :br)
|
9
|
+
assert_equal 1, result.count
|
10
|
+
assert_equal 'Corpus Christi', result.first[:name]
|
11
|
+
|
12
|
+
result = Holidays.on(Date.new(2014, 6, 23), :co)
|
13
|
+
assert_equal 1, result.count
|
14
|
+
assert_equal 'Corpus Christi', result.first[:name]
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_custom_loaded_region_returns_correct_value_with_function_modifier_conflict_even_if_conflict_definition_is_loaded_first
|
18
|
+
Holidays.load_custom('test/data/test_multiple_regions_with_conflicts_region_1.yaml')
|
19
|
+
result = Holidays.on(Date.new(2019, 6, 20), :multiple_with_conflict_1)
|
20
|
+
assert_equal 1, result.count
|
21
|
+
assert_equal 'With Function Modifier', result.first[:name]
|
22
|
+
|
23
|
+
Holidays.load_custom('test/data/test_multiple_regions_with_conflicts_region_2.yaml')
|
24
|
+
result = Holidays.on(Date.new(2019, 6, 24), :multiple_with_conflict_2)
|
25
|
+
assert_equal 1, result.count
|
26
|
+
assert_equal 'With Function Modifier', result.first[:name]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -14,7 +14,7 @@ class NonstandardRegionsHolidaysTests < Test::Unit::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_federalreservebanks_independence_day
|
17
|
-
h = Holidays.on(Date.new(
|
17
|
+
h = Holidays.on(Date.new(2019,7,4), :federalreservebanks, :observed)
|
18
18
|
assert_equal 'Independence Day', h[0][:name]
|
19
19
|
end
|
20
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holidays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,42 +59,42 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '3
|
62
|
+
version: '3'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '3
|
69
|
+
version: '3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: mocha
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '1
|
76
|
+
version: '1'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '1
|
83
|
+
version: '1'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: pry
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0.
|
90
|
+
version: '0.12'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
97
|
+
version: '0.12'
|
98
98
|
description: A collection of Ruby methods to deal with statutory and other holidays.
|
99
99
|
You deserve a holiday!
|
100
100
|
email:
|
@@ -158,12 +158,14 @@ files:
|
|
158
158
|
- lib/generated_definitions/li.rb
|
159
159
|
- lib/generated_definitions/lt.rb
|
160
160
|
- lib/generated_definitions/lu.rb
|
161
|
+
- lib/generated_definitions/lv.rb
|
161
162
|
- lib/generated_definitions/ma.rb
|
162
163
|
- lib/generated_definitions/mt_en.rb
|
163
164
|
- lib/generated_definitions/mt_mt.rb
|
164
165
|
- lib/generated_definitions/mx.rb
|
165
166
|
- lib/generated_definitions/my.rb
|
166
167
|
- lib/generated_definitions/nerc.rb
|
168
|
+
- lib/generated_definitions/ng.rb
|
167
169
|
- lib/generated_definitions/nl.rb
|
168
170
|
- lib/generated_definitions/no.rb
|
169
171
|
- lib/generated_definitions/northamerica.rb
|
@@ -183,6 +185,7 @@ files:
|
|
183
185
|
- lib/generated_definitions/si.rb
|
184
186
|
- lib/generated_definitions/sk.rb
|
185
187
|
- lib/generated_definitions/southamerica.rb
|
188
|
+
- lib/generated_definitions/th.rb
|
186
189
|
- lib/generated_definitions/tn.rb
|
187
190
|
- lib/generated_definitions/tr.rb
|
188
191
|
- lib/generated_definitions/ua.rb
|
@@ -241,6 +244,8 @@ files:
|
|
241
244
|
- test/data/test_custom_year_range_holiday_defs.yaml
|
242
245
|
- test/data/test_invalid_region.rb
|
243
246
|
- test/data/test_multiple_custom_holiday_defs.yaml
|
247
|
+
- test/data/test_multiple_regions_with_conflicts_region_1.yaml
|
248
|
+
- test/data/test_multiple_regions_with_conflicts_region_2.yaml
|
244
249
|
- test/data/test_region.rb
|
245
250
|
- test/data/test_single_custom_holiday_defs.yaml
|
246
251
|
- test/data/test_single_custom_holiday_with_custom_procs.yaml
|
@@ -283,12 +288,14 @@ files:
|
|
283
288
|
- test/defs/test_defs_li.rb
|
284
289
|
- test/defs/test_defs_lt.rb
|
285
290
|
- test/defs/test_defs_lu.rb
|
291
|
+
- test/defs/test_defs_lv.rb
|
286
292
|
- test/defs/test_defs_ma.rb
|
287
293
|
- test/defs/test_defs_mt_en.rb
|
288
294
|
- test/defs/test_defs_mt_mt.rb
|
289
295
|
- test/defs/test_defs_mx.rb
|
290
296
|
- test/defs/test_defs_my.rb
|
291
297
|
- test/defs/test_defs_nerc.rb
|
298
|
+
- test/defs/test_defs_ng.rb
|
292
299
|
- test/defs/test_defs_nl.rb
|
293
300
|
- test/defs/test_defs_no.rb
|
294
301
|
- test/defs/test_defs_northamerica.rb
|
@@ -308,6 +315,7 @@ files:
|
|
308
315
|
- test/defs/test_defs_si.rb
|
309
316
|
- test/defs/test_defs_sk.rb
|
310
317
|
- test/defs/test_defs_southamerica.rb
|
318
|
+
- test/defs/test_defs_th.rb
|
311
319
|
- test/defs/test_defs_tn.rb
|
312
320
|
- test/defs/test_defs_tr.rb
|
313
321
|
- test/defs/test_defs_ua.rb
|
@@ -362,6 +370,7 @@ files:
|
|
362
370
|
- test/integration/test_holidays.rb
|
363
371
|
- test/integration/test_holidays_between.rb
|
364
372
|
- test/integration/test_multiple_regions.rb
|
373
|
+
- test/integration/test_multiple_regions_with_conflict.rb
|
365
374
|
- test/integration/test_nonstandard_regions.rb
|
366
375
|
- test/test_helper.rb
|
367
376
|
homepage: https://github.com/holidays/holidays
|
@@ -376,15 +385,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
376
385
|
requirements:
|
377
386
|
- - "~>"
|
378
387
|
- !ruby/object:Gem::Version
|
379
|
-
version: '2.
|
388
|
+
version: '2.4'
|
380
389
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
381
390
|
requirements:
|
382
391
|
- - ">="
|
383
392
|
- !ruby/object:Gem::Version
|
384
393
|
version: '0'
|
385
394
|
requirements: []
|
386
|
-
|
387
|
-
rubygems_version: 2.7.6
|
395
|
+
rubygems_version: 3.1.2
|
388
396
|
signing_key:
|
389
397
|
specification_version: 4
|
390
398
|
summary: A collection of Ruby methods to deal with statutory and other holidays.
|
@@ -395,6 +403,8 @@ test_files:
|
|
395
403
|
- test/data/test_custom_year_range_holiday_defs.yaml
|
396
404
|
- test/data/test_invalid_region.rb
|
397
405
|
- test/data/test_multiple_custom_holiday_defs.yaml
|
406
|
+
- test/data/test_multiple_regions_with_conflicts_region_1.yaml
|
407
|
+
- test/data/test_multiple_regions_with_conflicts_region_2.yaml
|
398
408
|
- test/data/test_region.rb
|
399
409
|
- test/data/test_single_custom_holiday_defs.yaml
|
400
410
|
- test/data/test_single_custom_holiday_with_custom_procs.yaml
|
@@ -437,12 +447,14 @@ test_files:
|
|
437
447
|
- test/defs/test_defs_li.rb
|
438
448
|
- test/defs/test_defs_lt.rb
|
439
449
|
- test/defs/test_defs_lu.rb
|
450
|
+
- test/defs/test_defs_lv.rb
|
440
451
|
- test/defs/test_defs_ma.rb
|
441
452
|
- test/defs/test_defs_mt_en.rb
|
442
453
|
- test/defs/test_defs_mt_mt.rb
|
443
454
|
- test/defs/test_defs_mx.rb
|
444
455
|
- test/defs/test_defs_my.rb
|
445
456
|
- test/defs/test_defs_nerc.rb
|
457
|
+
- test/defs/test_defs_ng.rb
|
446
458
|
- test/defs/test_defs_nl.rb
|
447
459
|
- test/defs/test_defs_no.rb
|
448
460
|
- test/defs/test_defs_northamerica.rb
|
@@ -462,6 +474,7 @@ test_files:
|
|
462
474
|
- test/defs/test_defs_si.rb
|
463
475
|
- test/defs/test_defs_sk.rb
|
464
476
|
- test/defs/test_defs_southamerica.rb
|
477
|
+
- test/defs/test_defs_th.rb
|
465
478
|
- test/defs/test_defs_tn.rb
|
466
479
|
- test/defs/test_defs_tr.rb
|
467
480
|
- test/defs/test_defs_ua.rb
|
@@ -516,5 +529,6 @@ test_files:
|
|
516
529
|
- test/integration/test_holidays.rb
|
517
530
|
- test/integration/test_holidays_between.rb
|
518
531
|
- test/integration/test_multiple_regions.rb
|
532
|
+
- test/integration/test_multiple_regions_with_conflict.rb
|
519
533
|
- test/integration/test_nonstandard_regions.rb
|
520
534
|
- test/test_helper.rb
|