HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //opt/alt/python35/lib/python3.5/site-packages/cerberus/tests/test_assorted.py
# -*- coding: utf-8 -*-

from cerberus.tests import assert_fail, assert_success


def test_clear_cache(validator):
    assert len(validator._valid_schemas) > 0
    validator.clear_caches()
    assert len(validator._valid_schemas) == 0


def test_docstring(validator):
    assert validator.__doc__


# Test that tesing with the sample schema works as expected
# as there might be rules with side-effects in it

def _test_that_test_fails(test, *args):
    try:
        test(*args)
    except AssertionError:
        pass
    else:
        raise AssertionError("test didn't fail")


def test_fail():
    _test_that_test_fails(assert_fail, {'an_integer': 60})


def test_success():
    _test_that_test_fails(assert_success, {'an_integer': 110})