factbook-readers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +3 -0
  3. data/Manifest.txt +56 -0
  4. data/README.md +196 -0
  5. data/Rakefile +34 -0
  6. data/data/attributes.yml +337 -0
  7. data/data/categories.csv +164 -0
  8. data/data/codes.csv +262 -0
  9. data/data/codesxref.csv +280 -0
  10. data/data/comparisons.csv +75 -0
  11. data/lib/factbook-readers.rb +59 -0
  12. data/lib/factbook-readers/attributes.rb +74 -0
  13. data/lib/factbook-readers/builder.rb +212 -0
  14. data/lib/factbook-readers/builder_item.rb +185 -0
  15. data/lib/factbook-readers/builder_json.rb +79 -0
  16. data/lib/factbook-readers/codes.rb +122 -0
  17. data/lib/factbook-readers/comparisons.rb +50 -0
  18. data/lib/factbook-readers/counter.rb +48 -0
  19. data/lib/factbook-readers/normalize.rb +43 -0
  20. data/lib/factbook-readers/page.rb +148 -0
  21. data/lib/factbook-readers/page_info.rb +12 -0
  22. data/lib/factbook-readers/reader_json.rb +51 -0
  23. data/lib/factbook-readers/sanitizer.rb +307 -0
  24. data/lib/factbook-readers/sect.rb +29 -0
  25. data/lib/factbook-readers/subsect.rb +18 -0
  26. data/lib/factbook-readers/table.rb +52 -0
  27. data/lib/factbook-readers/utils.rb +47 -0
  28. data/lib/factbook-readers/utils_info.rb +129 -0
  29. data/lib/factbook-readers/version.rb +24 -0
  30. data/lib/factbook/readers.rb +5 -0
  31. data/test/data/au.html +579 -0
  32. data/test/data/au.yml +8 -0
  33. data/test/data/be.html +596 -0
  34. data/test/data/be.yml +8 -0
  35. data/test/data/json/au.json +892 -0
  36. data/test/data/src/ag.html +716 -0
  37. data/test/data/src/au-2015-09-24.html +2006 -0
  38. data/test/data/src/au.html +658 -0
  39. data/test/data/src/be-2015-09-24.html +2011 -0
  40. data/test/data/src/be.html +648 -0
  41. data/test/helper.rb +11 -0
  42. data/test/test_attribs.rb +87 -0
  43. data/test/test_attribs_def.rb +20 -0
  44. data/test/test_builder.rb +35 -0
  45. data/test/test_codes.rb +76 -0
  46. data/test/test_comparisons.rb +19 -0
  47. data/test/test_convert.rb +30 -0
  48. data/test/test_counter.rb +31 -0
  49. data/test/test_fields.rb +52 -0
  50. data/test/test_importer.rb +56 -0
  51. data/test/test_item_builder.rb +99 -0
  52. data/test/test_json.rb +45 -0
  53. data/test/test_json_builder.rb +25 -0
  54. data/test/test_normalize.rb +23 -0
  55. data/test/test_page.rb +38 -0
  56. data/test/test_sanitizer.rb +39 -0
  57. data/test/test_sanitizer_regex.rb +89 -0
  58. metadata +196 -0
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ ## $:.unshift(File.dirname(__FILE__))
4
+
5
+ ## minitest setup
6
+ require 'minitest/autorun'
7
+
8
+
9
+ ## our own code
10
+ require 'factbook'
11
+
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_attribs.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestAttribs < MiniTest::Test
11
+
12
+ def read_test_page( code )
13
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
14
+ page = Factbook::Page.new( code, html: html )
15
+ page
16
+ end
17
+
18
+ def read_test_page_from_json( code )
19
+ json = File.read( "#{Factbook.root}/test/data/json/#{code}.json" )
20
+ page = Factbook::Page.new( code, json: json )
21
+ page
22
+ end
23
+
24
+
25
+ def test_au_from_html
26
+ page = read_test_page( 'au' ) # note: use builtin test page (do NOT fetch via internet)
27
+
28
+ assert_page_au( page )
29
+ end
30
+
31
+ def xxx_test_au_from_json
32
+
33
+ ## todo/fix: check some issue with newlines? when comparing background or something ???
34
+ page = read_test_page_from_json( 'au' )
35
+
36
+ assert_page_au( page )
37
+ end
38
+
39
+ private
40
+ def assert_page_au( page )
41
+ ########
42
+ ## Introduction
43
+ assert_equal page.background, "Once the center of power for the large Austro-Hungarian Empire, Austria was reduced to a small republic after its defeat in World War I. Following annexation by Nazi Germany in 1938 and subsequent occupation by the victorious Allies in 1945, Austria's status remained unclear for a decade. A State Treaty signed in 1955 ended the occupation, recognized Austria's independence, and forbade unification with Germany. A constitutional law that same year declared the country's \"perpetual neutrality\" as a condition for Soviet military withdrawal. The Soviet Union's collapse in 1991 and Austria's entry into the EU in 1995 have altered the meaning of this neutrality. A prosperous, democratic country, Austria entered the EU Economic and Monetary Union in 1999."
44
+
45
+ ###########
46
+ ## Geography
47
+ assert_equal page.area, "83,871 sq km"
48
+ assert_equal page.area_land, "82,445 sq km"
49
+ assert_equal page.area_water, "1,426 sq km"
50
+ assert_equal page.area_note, nil
51
+ assert_equal page.area_comparative, "about the size of South Carolina; slightly more than two-thirds the size of Pennsylvania"
52
+ assert_equal page.climate, "temperate; continental, cloudy; cold winters with frequent rain and some snow in lowlands and snow in mountains; moderate summers with occasional showers"
53
+ assert_equal page.terrain, "mostly mountains (Alps) in the west and south; mostly flat or gently sloping along the eastern and northern margins"
54
+
55
+ # was:
56
+ ## assert_equal page.elevation_lowest, "Neusiedler See 115 m"
57
+ ## assert_equal page.elevation_highest, "Grossglockner 3,798 m"
58
+ ## new ????
59
+ ## assert_equal page.elevation_extremes, "lowest point: Neusiedler See 115 m ++ highest point: Grossglockner 3,798 m"
60
+
61
+ assert_equal page.resources, "oil, coal, lignite, timber, iron ore, copper, zinc, antimony, magnesite, tungsten, graphite, salt, hydropower"
62
+
63
+ ###################
64
+ ## People and Society
65
+ assert_equal page.languages, "German (official nationwide) 88.6%, Turkish 2.3%, Serbian 2.2%, Croatian (official in Burgenland) 1.6%, other (includes Slovene, official in South Carinthia, and Hungarian, official in Burgenland) 5.3% (2001 est.)"
66
+ assert_equal page.religions, "Catholic 73.8% (includes Roman Catholic 73.6%, other Catholic 0.2%), Protestant 4.9%, Muslim 4.2%, Orthodox 2.2%, other 0.8% (includes other Christian), none 12%, unspecified 2% (2001 est.)"
67
+ assert_equal page.population, "8,711,770 (July 2016 est.)"
68
+ assert_equal page.population_growth, "0.51% (2016 est.)"
69
+ assert_equal page.birth_rate, "9.5 births/1,000 population (2016 est.)"
70
+ assert_equal page.death_rate, "9.5 deaths/1,000 population (2016 est.)"
71
+ assert_equal page.migration_rate, "5.2 migrant(s)/1,000 population (2016 est.)"
72
+ assert_equal page.major_cities, "VIENNA (capital) 1.753 million (2015)"
73
+
74
+
75
+ ####################
76
+ ## Economy
77
+ ## assert_equal page.economy_overview, "Austria, with its well-developed market economy, skilled labor force, and high standard of living, is closely tied to other EU economies, especially Germany's. Its economy features a large service sector, a relatively sound industrial sector, and a small, but highly developed agricultural sector. Economic growth was anemic at less than 0.5% in 2013 and 2014, and growth in 2015 is not expected to exceed 0.5%. Austria’s 5.6% unemployment rate, while low by European standards, is at an historic high for Austria. Without extensive vocational training programs and generous early retirement, the unemployment rate would be even higher. Public finances have not stabilized even after a 2012 austerity package of expenditure cuts and new revenues. On the contrary, in 2014, the government created a “bad bank” for the troubled nationalized “Hypo Alpe Adria” bank, pushing the budget deficit up by 0.9% of GDP to 2.4% and public debt to 84.5% of the GDP. Although Austria's fiscal position compares favorably with other euro-zone countries, it faces several external risks, such as Austrian banks' continued exposure to Central and Eastern Europe, repercussions from the Hypo Alpe Adria bank collapse, political and economic uncertainties caused by the European sovereign debt crisis, the current crisis in Russia/Ukraine, the recent appreciation of the Swiss Franc, and political developments in Hungary."
78
+ assert_equal page.gdp_ppp, "$405.1 billion (2015 est.) ++ $401.6 billion (2014 est.) ++ $400.2 billion (2013 est.)"
79
+ assert_equal page.gdp_ppp_note, "data are in 2015 US dollars"
80
+ assert_equal page.gdp, "$374.3 billion (2015 est.)"
81
+ assert_equal page.gdp_growth, "0.9% (2015 est.) ++ 0.4% (2014 est.) ++ 0.3% (2013 est.)"
82
+ assert_equal page.gdp_ppp_capita, "$47,000 (2015 est.) ++ $47,000 (2014 est.) ++ $47,200 (2013 est.)"
83
+ assert_equal page.gdp_ppp_capita_note, "data are in 2015 US dollars"
84
+ assert_equal page.saving, "25% of GDP (2015 est.) ++ 24.7% of GDP (2014 est.) ++ 25.2% of GDP (2013 est.)"
85
+ end
86
+
87
+ end # class TestAttribs
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_attribs_def.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestAttribsDef < MiniTest::Test
11
+
12
+ def test_attribs
13
+
14
+ attribs = Factbook.attributes
15
+ pp attribs
16
+
17
+ assert true
18
+ end
19
+
20
+ end # class TestAttribsDef
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_builder.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ ##
12
+ ## use/fix: ASCII-8BIT (e.g.keep as is)
13
+
14
+
15
+ class TestBuilder < MiniTest::Test
16
+
17
+ def test_build
18
+
19
+ ['au','be'].each do |code|
20
+ ## use/fix: ASCII-8BIT (e.g.keep as is) -???
21
+ ## fix/todo: use ASCII8BIT/binary reader ??
22
+ b = Factbook::Builder.from_file( "#{Factbook.root}/test/data/src/#{code}.html" )
23
+ pp b.sects
24
+
25
+ File.open( "./tmp/#{code}.debug.html", 'w' ) do |f|
26
+ f.write b.html_debug
27
+ end
28
+ end
29
+
30
+ assert true ## assume everthing ok
31
+ end
32
+
33
+
34
+ end # class TestBuilder
35
+
@@ -0,0 +1,76 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_codes.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestCodes < MiniTest::Test
12
+
13
+
14
+ def test_codes
15
+
16
+ assert_equal 261, Factbook::CODES.size
17
+ assert_equal 261, Factbook.codes.size
18
+ assert_equal 261, Factbook.codes.to_a.size
19
+
20
+
21
+ assert_equal 195, Factbook.codes.countries.size
22
+ assert_equal 52, Factbook.codes.dependencies.size
23
+ assert_equal 5, Factbook.codes.oceans.size
24
+ assert_equal 1, Factbook.codes.world.size
25
+ assert_equal 2, Factbook.codes.others.size
26
+ assert_equal 6, Factbook.codes.misc.size
27
+
28
+ assert_equal 8, Factbook.codes.dependencies_us.size
29
+
30
+
31
+ assert_equal 55, Factbook.codes.europe.size
32
+ assert_equal 9, Factbook.codes.south_asia.size
33
+ assert_equal 6, Factbook.codes.central_asia.size
34
+ assert_equal 22, Factbook.codes.east_n_souteast_asia.size
35
+ assert_equal 19, Factbook.codes.middle_east.size
36
+ assert_equal 56, Factbook.codes.africa.size
37
+ assert_equal 7, Factbook.codes.north_america.size
38
+ assert_equal 33, Factbook.codes.central_america_n_caribbean.size
39
+ assert_equal 14, Factbook.codes.south_america.size
40
+ assert_equal 30, Factbook.codes.australia_oceania.size
41
+ assert_equal 4, Factbook.codes.antartica.size
42
+ assert_equal 5, Factbook.codes.region('Oceans').size
43
+ assert_equal 1, Factbook.codes.region('World').size
44
+
45
+ assert_equal 45, Factbook.codes.countries.europe.size
46
+
47
+ assert_equal Factbook.codes.category('Oceans').size, Factbook.codes.region('Oceans').size
48
+ assert_equal Factbook.codes.category('World').size, Factbook.codes.region('World').size
49
+
50
+
51
+ assert_equal 261, Factbook.codes.countries.size +
52
+ Factbook.codes.others.size +
53
+ Factbook.codes.dependencies.size +
54
+ Factbook.codes.misc.size +
55
+ Factbook.codes.oceans.size +
56
+ Factbook.codes.world.size
57
+
58
+ assert_equal 261, Factbook.codes.europe.size +
59
+ Factbook.codes.south_asia.size +
60
+ Factbook.codes.central_asia.size +
61
+ Factbook.codes.east_n_souteast_asia.size +
62
+ Factbook.codes.middle_east.size +
63
+ Factbook.codes.africa.size +
64
+ Factbook.codes.north_america.size +
65
+ Factbook.codes.central_america_n_caribbean.size +
66
+ Factbook.codes.south_america.size +
67
+ Factbook.codes.australia_oceania.size +
68
+ Factbook.codes.antartica.size +
69
+ Factbook.codes.region('Oceans').size +
70
+ Factbook.codes.region('World').size
71
+
72
+ end
73
+
74
+ end # class TestCodes
75
+
76
+
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_comparisons.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestComparisons < MiniTest::Test
12
+
13
+ def test_comparisons
14
+ assert_equal 74, Factbook::COMPARISONS.size
15
+ assert_equal 74, Factbook.comparisons.size
16
+ assert_equal 74, Factbook.comparisons.to_a.size
17
+ end
18
+
19
+ end # class TestComparisons
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_convert.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestConvert < MiniTest::Test
11
+
12
+ def test_au
13
+ im = Factbook::Importer.new
14
+
15
+ ###########
16
+ ## Geography
17
+ assert_equal 83_871, im.sq_km( "83,871 sq km" ) ## page.area
18
+ assert_equal 82_445, im.sq_km( "82,445 sq km" ) ## page.area_land
19
+ assert_equal 1_426, im.sq_km( "1,426 sq km" ) ## page.area_water
20
+
21
+ ###################
22
+ ## People and Society
23
+ assert_equal 8_665_550, im.num( "8,665,550 (July 2015 est.)" ) ## page.population
24
+ assert_equal 0.55, im.percent( "0.55% (2015 est.)" ) ## page.population_growth
25
+ assert_equal 9.41, im.rate_per_thousand( "9.41 births/1,000 population (2015 est.)" ) ## page.birth_rate
26
+ assert_equal 9.42, im.rate_per_thousand( "9.42 deaths/1,000 population (2015 est.)" ) ## page.death_rate
27
+ assert_equal 5.56, im.rate_per_thousand( "5.56 migrant(s)/1,000 population (2015 est.)" ) ## page.migration_rate
28
+ end
29
+
30
+ end # class TestConvert
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_counter.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestCounter < MiniTest::Test
11
+
12
+ def read_test_page( code )
13
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
14
+ page = Factbook::Page.new( code, html: html )
15
+ end
16
+
17
+ def test_counter
18
+ c = Factbook::Counter.new
19
+
20
+ codes = %w(au be)
21
+ codes.each do |code|
22
+ c.count( read_test_page( code )) # use builtin test page (do NOT fetch via internet)
23
+ end
24
+
25
+ h = c.data
26
+ pp h
27
+
28
+ assert true ## assume everything ok if we get here
29
+ end
30
+
31
+ end # class TestCounter
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_fields.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestFields < MiniTest::Test
11
+
12
+ def read_test_page( code )
13
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
14
+ page = Factbook::Page.new( code, html: html )
15
+ page
16
+ end
17
+
18
+ def test_fields_full
19
+ ## Factbook::Page.new( 'au', fields: 'full' )
20
+ page = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
21
+
22
+ assert_equal '-1.1% of GDP (2015 est.)', page['Economy']['Budget surplus (+) or deficit (-)']['text']
23
+ assert_equal '0.7%', page['Economy']['Labor force - by occupation']['agriculture']['text']
24
+
25
+ assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['Transportation']['Ports and terminals']['river port(s)']['text']
26
+ end
27
+
28
+ def fix_xxx_test_fields_full_w_header
29
+ page = Factbook::OldPage.new( 'au', header: true, fields: 'full' )
30
+ page.html = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
31
+
32
+ assert_equal 'au', page['Header']['code']
33
+ assert_equal "factbook/#{Factbook::VERSION}", page['Header']['generator']
34
+
35
+ assert_equal '-2.4% of GDP (2014 est.)', page['Economy']['Budget surplus (+) or deficit (-)']['text']
36
+ assert_equal '5.5%', page['Economy']['Labor force - by occupation']['agriculture']
37
+
38
+ assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['Transportation']['Ports and terminals']['river port(s)']
39
+ end
40
+
41
+ def fix_xxx_test_fields_std
42
+ page = Factbook::OldPage.new( 'au' )
43
+ page.html = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
44
+
45
+ assert_equal '-2.4% of GDP (2014 est.)', page['econ']['budget_surplus_or_deficit']['text']
46
+ assert_equal '5.5%', page['econ']['labor_force_by_occupation']['agriculture']
47
+
48
+ assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['trans']['ports_and_terminals']['river_ports']
49
+ end
50
+
51
+
52
+ end # class TestFields
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_importer.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestImporter < MiniTest::Test
11
+
12
+ def setup_in_memory_db
13
+ # Database Setup & Config
14
+ ActiveRecord::Base.logger = Logger.new( STDOUT )
15
+ ## ActiveRecord::Base.colorize_logging = false - no longer exists - check new api/config setting?
16
+
17
+ ActiveRecord::Base.establish_connection( adapter: 'sqlite3',
18
+ database: ':memory:' )
19
+
20
+ ## build schema
21
+ Factbook::CreateDb.new.up
22
+ end
23
+
24
+ def read_test_page( code )
25
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
26
+ page = Factbook::Page.new( code, html: html )
27
+ page
28
+ end
29
+
30
+
31
+ def to_be_done_test_au_fix_me
32
+ page = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
33
+
34
+ setup_in_memory_db()
35
+
36
+ im = Factbook::Importer.new
37
+ im.import( page )
38
+
39
+ rec = Factbook::Fact.find_by! code: 'au'
40
+
41
+ ###########
42
+ ## Geography
43
+ assert_equal 83_871, rec.area
44
+ assert_equal 82_445, rec.area_land
45
+ assert_equal 1_426, rec.area_water
46
+
47
+ ###################
48
+ ## People and Society
49
+ assert_equal 8_665_550, rec.population
50
+ assert_equal 0.55, rec.population_growth
51
+ assert_equal 9.41, rec.birth_rate
52
+ assert_equal 9.42, rec.death_rate
53
+ assert_equal 5.56, rec.migration_rate
54
+ end
55
+
56
+ end # class TestImporter
@@ -0,0 +1,99 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_item_builder.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestItemBuilder < MiniTest::Test
12
+
13
+ def test_location
14
+
15
+ html =<<EOS
16
+ <div class=category_data>Central Europe, north of Italy and Slovenia</div>
17
+ EOS
18
+
19
+ b = Factbook::ItemBuilder.new( html, 'Location' )
20
+ b.read
21
+
22
+ assert true ## assume everthing ok
23
+ end
24
+
25
+ def test_area
26
+ html =<<EOS
27
+ <div><span class=category>total: </span><span class=category_data>83,871 sq km</span></div>
28
+ <div><span class=category>land: </span><span class=category_data>82,445 sq km</span></div>
29
+ <div><span class=category>water: </span><span class=category_data>1,426 sq km</span></div>
30
+ EOS
31
+
32
+ b = Factbook::ItemBuilder.new( html, 'Area' )
33
+ b.read
34
+
35
+ assert true ## assume everthing ok
36
+ end
37
+
38
+ def test_land_use
39
+ html =<<EOS
40
+ <div><span class=category>agricultural land: </span><span class=category_data>38.4%</span></div>
41
+ <div class=category_data>arable land 16.5%; permanent crops 0.8%; permanent pasture 21.1%</div>
42
+ <div><span class=category>forest: </span><span class=category_data>47.2%</span></div>
43
+ <div><span class=category>other: </span><span class=category_data>14.4% (2011 est.)</span></div>
44
+ EOS
45
+
46
+ b = Factbook::ItemBuilder.new( html, 'Land use' )
47
+ b.read
48
+
49
+ assert true ## assume everthing ok
50
+ end
51
+
52
+ def test_contraceptive_prevalence_rate
53
+ html =<<EOS
54
+ <div class=category_data>69.6%</div>
55
+ <div><span class=category>note: </span><span class=category_data>percent of women aged 18-46 (2008/09)</span></div>
56
+ EOS
57
+
58
+ b = Factbook::ItemBuilder.new( html, 'Contraceptive Prevalence Rate' )
59
+ b.read
60
+
61
+ assert true ## assume everthing ok
62
+ end
63
+
64
+ def test_drinking_water_source
65
+ html =<<EOS
66
+ <div><span class=category>improved: </span><span class=category_data></span></div>
67
+ <div class=category_data>urban: 100% of population</div>
68
+ <div class=category_data>rural: 100% of population</div>
69
+ <div class=category_data>total: 100% of population</div>
70
+ <div><span class=category>unimproved: </span><span class=category_data></span></div>
71
+ <div class=category_data>urban: 0% of population</div>
72
+ <div class=category_data>rural: 0% of population</div>
73
+ <div class=category_data>total: 0% of population (2015 est.)</div>
74
+ EOS
75
+
76
+ b = Factbook::ItemBuilder.new( html, 'Drinking Water Source' )
77
+ b.read
78
+
79
+ assert true ## assume everthing ok
80
+ end
81
+
82
+ def test_political_pressure_groups_and_leaders
83
+ html =<<EOS
84
+ <div class=category_data>Austrian Trade Union Federation or OeGB (nominally independent but primarily Social Democratic)</div>
85
+ <div class=category_data>Federal Economic Chamber (OeVP-dominated)</div>
86
+ <div class=category_data>Labor Chamber or AK (Social Democratic-leaning think tank)</div>
87
+ <div class=category_data>OeVP-oriented Association of Austrian Industrialists or IV</div>
88
+ <div class=category_data>Roman Catholic Church, including its chief lay organization, Catholic Action</div>
89
+ <div><span class=category>other: </span><span class=category_data>three composite leagues of the Austrian People's Party or OeVP representing business, labor, farmers, and other nongovernment organizations in the areas of environment and human rights</span></div>
90
+ EOS
91
+
92
+ b = Factbook::ItemBuilder.new( html, 'Political pressure groups and leaders' )
93
+ b.read
94
+
95
+ assert true ## assume everthing ok
96
+ end
97
+
98
+ end # class TestItemBuilder
99
+