##// END OF EJS Templates
deps: bumped pyparsing for EE edition
deps: bumped pyparsing for EE edition

File last commit:

r1126:f96985cd python3
r1132:1a642563 default
Show More
test_utils.py
53 lines | 1.5 KiB | text/x-python | PythonLexer
# RhodeCode VCSServer provides access to different vcs backends via network.
# Copyright (C) 2014-2023 RhodeCode GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import pytest
from vcsserver.str_utils import ascii_bytes, ascii_str
@pytest.mark.parametrize('given, expected', [
('a', b'a'),
('a', b'a'),
])
def test_ascii_bytes(given, expected):
assert ascii_bytes(given) == expected
@pytest.mark.parametrize('given', [
'å',
'å'.encode('utf8')
])
def test_ascii_bytes_raises(given):
with pytest.raises(ValueError):
ascii_bytes(given)
@pytest.mark.parametrize('given, expected', [
(b'a', 'a'),
])
def test_ascii_str(given, expected):
assert ascii_str(given) == expected
@pytest.mark.parametrize('given', [
'a',
'å'.encode('utf8'),
'å'
])
def test_ascii_str_raises(given):
with pytest.raises(ValueError):
ascii_str(given)