12 from __future__
import print_function
15 VERSION =
'debug --- 2010 March 16'
17 import collections, inspect, sys
39 assertspeed = ASSERT_NORMAL
48 """Renvoie assertspeed sous forme d'un string
51 return (
'ASSERT_QUICK',
'ASSERT_NORMAL',
'ASSERT_FAT')[assertspeed - ASSERT_QUICK]
56 """Renvoie un tuple des types de collections ABC supportées par item
58 Result: tuple de string
62 for t
in (
'Container',
'Hashable',
'Iterable',
'Iterator',
'Sized',
'Callable',
63 'Sequence',
'MutableSequence',
'Set',
'MutableSet',
'Mapping',
'MutableMapping',
64 'MappingView',
'KeysView',
'ItemsView',
'ValuesView'):
65 if inspect.isclass(item):
66 if issubclass(item, eval(
'collections.' + t)):
69 if isinstance(item, eval(
'collections.' + t)):
75 def test_begin(version, debug, header='', args=sys.argv[1:]):
76 """Envoie sur la sortie des standards le message de début de test
81 args: liste de string"""
84 ASSERT_OPTS = {
'--quick': ASSERT_QUICK,
85 '--normal': ASSERT_NORMAL,
88 print(
'*** {0}{1} --- __debug__ == {2}'.format(header, version, debug))
92 assertspeed = ASSERT_OPTS[arg]
95 print(
"*** args: '{0}'".format(
"' '".join(args))
if args
96 else '*** args:', end=
' ')
97 print(
'--- assertspeed == ASSERT_{0}'
98 .format(dict(zip(ASSERT_OPTS.values(), ASSERT_OPTS.keys()))[assertspeed][2:].upper()))
106 """Envoie sur la sortie des standards le message de fin de test"""
115 if __name__ ==
'__main__':
120 print(
'assertspeed_str() ==', end=
' '); sys.stdout.flush()
122 print(
'ok'); sys.stdout.flush()