/
githubmirror
/
edx-platform
Обзор
Документация
Войти
/
githubmirror
/
edx-platform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-ulmo
common/djangoapps/util/tests/test_string_utils.py
36 строк
925 B
Aarif
replaced unittest assertions pytest assertions (#26528)
18 фев 2021, 16:09
Не верифицирован
18 фев 2021, 16:09
a1406cd
Код
Авторство
О чём код?
""" Tests for string_utils.py """ import pytest from django.test import TestCase from common.djangoapps.util.string_utils import str_to_bool class StringUtilsTest(TestCase): """ Tests for str_to_bool. """ def test_str_to_bool_true(self): assert str_to_bool('True') assert str_to_bool('true') assert str_to_bool('trUe') def test_str_to_bool_false(self): assert not str_to_bool('Tru') assert not str_to_bool('False') assert not str_to_bool('false') assert not str_to_bool('') assert not str_to_bool(None) assert not str_to_bool('anything') def test_str_to_bool_errors(self): def test_raises_error(val): with pytest.raises(AttributeError): assert not str_to_bool(val) test_raises_error({}) test_raises_error([]) test_raises_error(1) test_raises_error(True)