Skip to content

Commit

Permalink
py27 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
staffanm committed Jun 10, 2018
1 parent 7586b28 commit 5ea4903
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion ferenda/sources/legal/se/myndfskr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import re
import json
from collections import OrderedDict
from functools import lru_cache
try:
from functools import lru_cache
except ImportError:
from backports.functools_lru_cache import lru_cache

from rdflib import URIRef, Literal, Namespace
from bs4 import BeautifulSoup
Expand Down
1 change: 1 addition & 0 deletions requirements.py2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ responses<0.6.0 # newer versions don't support 2.6
importlib
langdetect
bz2file # backport
backports.functools_lru_cache # another backport
4 changes: 2 additions & 2 deletions test/testTOC.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def test_generate_page(self):

# 2.2 JS links, relativized correctly?
js = t.findall("body/script")
self.assertEqual(len(js), 5) # jquery, bootstrap, hammer, typeahead, ferenda
self.assertRegex(js[4].get('src'), '^../../../rsrc/js')
self.assertEqual(len(js), 4) # jquery, bootstrap, typeahead, ferenda
self.assertRegex(js[3].get('src'), '^../../../rsrc/js')
# 2.3 <nav id="toc"> correct (c.f 1.2)
navlinks = t.findall(".//nav[@id='toc']//li/a")
self.assertEqual(len(navlinks),9)
Expand Down
3 changes: 1 addition & 2 deletions test/testWSGI.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,7 @@ def test_search_multiple(self):
self.assertEqual('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',
css[0].get('href'))
js = t.findall("body/script")
self.assertEqual(len(js), 5) # jquery, bootstrap, hammer, ferenda, typeahead

self.assertEqual(len(js), 4) # jquery, bootstrap, ferenda, typeahead
resulthead = t.find(".//article/h1").text
self.assertEqual(resulthead, "3 matches for 'part'")
docs = t.findall(".//section[@class='hit']")
Expand Down

0 comments on commit 5ea4903

Please sign in to comment.