Skip to content

Commit

Permalink
Test text-based file objects for HTML and CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Dec 16, 2023
1 parent 95c9dc0 commit 752e53d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def _test_resource(class_, basename, check, **kwargs):
check(class_(relative_path, **kwargs))
kwargs.pop('base_url', None)
check(class_(string=content, base_url=relative_filename, **kwargs))
encoding = kwargs.get('encoding') or 'utf-8'
encoding = kwargs.pop('encoding', 'utf-8')
with open(absolute_filename, 'r', encoding=encoding) as fd:
check(class_(file_obj=fd, **kwargs))
check(class_(string=content.decode(encoding), # unicode
base_url=relative_filename, **kwargs))
with pytest.raises(TypeError):
Expand Down

0 comments on commit 752e53d

Please sign in to comment.