~ruby/pythoscope/itrade-fixes

« back to all changes in this revision

Viewing changes to pythoscope/generator/__init__.py

  • Committer: Michal Kwiatkowski
  • Date: 2009-01-28 15:10:49 UTC
  • Revision ID: constant.beta@gmail.com-20090128151049-7imunq6ntpvs5f8m
Test generator no longer ignores special methods.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    key_for_value, pluralize, set, sorted, underscore, union
12
12
 
13
13
 
14
 
CREATIONAL_METHODS = ['__init__', '__new__']
15
 
 
16
14
# :: [string] -> string
17
15
def list_of(strings):
18
16
    return "[%s]" % ', '.join(strings)
493
491
    return string
494
492
 
495
493
def should_ignore_method(method):
496
 
    return method.name.startswith('_') and \
497
 
        method.name not in CREATIONAL_METHODS
 
494
    return method.is_private()
498
495
 
499
496
def testable_calls(calls):
500
497
    return [c for c in calls if c.is_testable()]
678
675
        setup = '# %s = %s\n' % (object_name, class_init_stub(klass))
679
676
        assertions = [('missing',)]
680
677
        # Generate assertion stub, but only for non-creational methods.
681
 
        if method.name not in CREATIONAL_METHODS:
 
678
        if not method.is_creational():
682
679
            assertions.insert(0, assertion_stub("%s.%s" % (object_name, method.name),
683
680
                                                method.get_call_args()))
684
681
        return TestMethodDescription(test_name, assertions=assertions, setup=setup)