~facundo/encuentro/trunk

« back to all changes in this revision

Viewing changes to tests/test_bacua_scrapers.py

  • Committer: Facundo Batista
  • Date: 2017-07-08 22:33:43 UTC
  • mfrom: (295.1.2 huge-renewal-refactor)
  • Revision ID: facundo@taniquetil.com.ar-20170708223343-8qk9hghezgtqf2uz
Massive renewal to bring the project back to life.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
 
3
 
# Copyright 2012-2015 Facundo Batista
 
1
# Copyright 2012-2017 Facundo Batista
4
2
#
5
3
# This program is free software: you can redistribute it and/or modify it
6
4
# under the terms of the GNU General Public License version 3, as published
201
199
    """Tests for the scrapers."""
202
200
 
203
201
    def test_example_list_1(self):
204
 
        html = open("tests/ej-bacua-list_1.html").read()
 
202
        html = open("tests/ej-bacua-list_1.html", 'rb').read()
205
203
        res = get_bacua_episodes.scrap_list_page(html)
206
204
        self.assertEqual(res, _RES_LIST_1)
207
205
 
208
206
    def test_example_page_1(self):
209
 
        html = open("tests/ej-bacua-page_1.html").read()
 
207
        html = open("tests/ej-bacua-page_1.html", 'rb').read()
210
208
        res = get_bacua_episodes.scrap_page(html)
211
209
        self.assertEqual(res, _RES_PAGE_1)
212
210
 
213
211
    def test_example_page_2(self):
214
 
        html = open("tests/ej-bacua-page_2.html").read()
 
212
        html = open("tests/ej-bacua-page_2.html", 'rb').read()
215
213
        res = get_bacua_episodes.scrap_page(html)
216
214
        self.assertEqual(res, _RES_PAGE_2)
217
215
 
218
216
    def test_example_page_3(self):
219
 
        html = open("tests/ej-bacua-page_3.html").read()
 
217
        html = open("tests/ej-bacua-page_3.html", 'rb').read()
220
218
        res = get_bacua_episodes.scrap_page(html)
221
219
        self.assertEqual(res, _RES_PAGE_3)
222
220
 
223
221
    def test_example_page_4(self):
224
 
        html = open("tests/ej-bacua-page_4.html").read()
 
222
        html = open("tests/ej-bacua-page_4.html", 'rb').read()
225
223
        res = get_bacua_episodes.scrap_page(html)
226
224
        self.assertEqual(res, _RES_PAGE_4)
227
225
 
228
226
    def test_example_page_5(self):
229
 
        html = open("tests/ej-bacua-page_5.html").read()
 
227
        html = open("tests/ej-bacua-page_5.html", 'rb').read()
230
228
        res = get_bacua_episodes.scrap_page(html)
231
229
        # print("\n=== res", [sorted(x.items()) for x in res])
232
230
        # print("=== RES", [sorted(x.items()) for x in _RES_PAGE_5])