mirror of https://github.com/yandex/gixy
parent
6f68624a75
commit
3bf5110983
|
@ -1,36 +0,0 @@
|
||||||
from nose.tools import assert_true, assert_false
|
|
||||||
|
|
||||||
|
|
||||||
'''
|
|
||||||
Various nose.tools helpers that doesn't exists in Python 2.6 Unittest :(
|
|
||||||
Must be removed with drop Python 2.6 support
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
def assert_is_instance(obj, cls, msg=None):
|
|
||||||
"""Same as assert_true(isinstance(obj, cls)), with a nicer
|
|
||||||
default message."""
|
|
||||||
if not msg:
|
|
||||||
msg = '{orig} is not an instance of {test}'.format(orig=type(obj), test=cls)
|
|
||||||
assert_true(isinstance(obj, cls), msg=msg)
|
|
||||||
|
|
||||||
|
|
||||||
def assert_is_none(obj, msg=None):
|
|
||||||
"""Same as assert_true(obj is None), with a nicer default message."""
|
|
||||||
if not msg:
|
|
||||||
msg = '{orig!r} is not None'.format(orig=obj)
|
|
||||||
assert_true(obj is None, msg=msg)
|
|
||||||
|
|
||||||
|
|
||||||
def assert_is_not_none(obj, msg=None):
|
|
||||||
"""Same as assert_false(obj is None), with a nicer default message."""
|
|
||||||
if not msg:
|
|
||||||
msg = '{orig!r} is None'.format(orig=obj)
|
|
||||||
assert_false(obj is None, msg=msg)
|
|
||||||
|
|
||||||
|
|
||||||
def assert_in(member, container, msg=None):
|
|
||||||
"""Just like assert_true(a in b), but with a nicer default message."""
|
|
||||||
if not msg:
|
|
||||||
msg = '{member!r} not found in {container!r}'.format(member=member, container=container)
|
|
||||||
assert_true(member in container, msg=msg)
|
|
|
@ -1,5 +1,4 @@
|
||||||
from nose.tools import assert_equals, assert_true, assert_false
|
from nose.tools import assert_equals, assert_true, assert_false, assert_is_instance, assert_is_none, assert_is_not_none
|
||||||
from tests.asserts import assert_is_instance, assert_is_none, assert_is_not_none
|
|
||||||
from gixy.parser.nginx_parser import NginxParser
|
from gixy.parser.nginx_parser import NginxParser
|
||||||
from gixy.directives.block import *
|
from gixy.directives.block import *
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from nose.tools import assert_equals, assert_false, assert_true
|
from nose.tools import assert_equals, assert_false, assert_true, assert_is_instance
|
||||||
from tests.asserts import assert_is_instance
|
|
||||||
from gixy.parser.nginx_parser import NginxParser
|
from gixy.parser.nginx_parser import NginxParser
|
||||||
from gixy.directives.directive import *
|
from gixy.directives.directive import *
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from nose.tools import assert_equal
|
from nose.tools import assert_equal, assert_is_instance
|
||||||
from tests.asserts import assert_is_instance
|
|
||||||
from gixy.parser.nginx_parser import NginxParser
|
from gixy.parser.nginx_parser import NginxParser
|
||||||
from gixy.directives.directive import *
|
from gixy.directives.directive import *
|
||||||
from gixy.directives.block import *
|
from gixy.directives.block import *
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from nose.tools import assert_equals, assert_true
|
from nose.tools import assert_equals, assert_true, assert_in
|
||||||
from tests.asserts import assert_in
|
|
||||||
import os
|
import os
|
||||||
from os import path
|
from os import path
|
||||||
import json
|
import json
|
||||||
|
|
Loading…
Reference in New Issue