mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix tests that depended on css serialization settings
This commit is contained in:
parent
d21e62c624
commit
5e9a3de623
@ -378,7 +378,7 @@ def test(return_tests=False): # {{{
|
||||
r = Rule(**rule)
|
||||
decl = StyleDeclaration(safe_parser().parseStyle(style))
|
||||
r.process_declaration(decl)
|
||||
return str(decl)
|
||||
return str(decl).rstrip(';')
|
||||
|
||||
class TestTransforms(unittest.TestCase):
|
||||
longMessage = True
|
||||
|
@ -416,7 +416,7 @@ def test_normalization(return_tests=False): # {{{
|
||||
css = '; '.join(f'border-{edge}-{p}: {v}' for edge in ('top',) for p, v in zip(BORDER_PROPS, vals.split()))
|
||||
style = parseStyle(css)
|
||||
condense_rule(style)
|
||||
self.assertEqual(css_text(style), 'border-top: %s' % vals)
|
||||
self.assertEqual(css_text(style).rstrip(';'), 'border-top: %s' % vals)
|
||||
css += ';' + '; '.join(f'border-{edge}-{p}: {v}' for edge in ('right', 'left', 'bottom') for p, v in
|
||||
zip(BORDER_PROPS, vals.replace('red', 'green').split()))
|
||||
style = parseStyle(css)
|
||||
|
@ -212,7 +212,7 @@ class CascadeTest(BaseTest):
|
||||
style = parseStyle('background-image: url(b.png); background: black url(a.png) fixed')
|
||||
for prop in style.getProperties(all=True):
|
||||
remove_property_value(prop, lambda val:'png' in val.cssText)
|
||||
self.assertEqual('background: black fixed', style.cssText)
|
||||
self.assertEqual('background: black fixed', style.cssText.rstrip(';'))
|
||||
|
||||
def test_fallback_font_matching(self):
|
||||
def cf(id, weight='normal', style='normal', stretch='normal'):
|
||||
|
@ -84,8 +84,10 @@ def itertests(suite):
|
||||
def init_env():
|
||||
from calibre.utils.config_base import reset_tweaks_to_default
|
||||
from calibre.ebooks.metadata.book.base import reset_field_metadata
|
||||
from calibre.ebooks.oeb.polish.utils import setup_css_parser_serialization
|
||||
reset_tweaks_to_default()
|
||||
reset_field_metadata()
|
||||
setup_css_parser_serialization()
|
||||
|
||||
|
||||
def filter_tests(suite, test_ok):
|
||||
|
Loading…
x
Reference in New Issue
Block a user