Пример #1
0
def test_bad_machines_fail(machine):
    test_class = machine.TestCase
    try:
        with capture_out() as o:
            with raises(AssertionError):
                test_class().runTest()
    except Exception:
        print_unicode(o.getvalue())
        raise
    v = o.getvalue()
    print_unicode(v)
    assert u'Step #1' in v
    assert u'Step #50' not in v
Пример #2
0
def test_bad_machines_fail(machine):
    test_class = machine.TestCase
    try:
        with capture_out() as o:
            with raises(AssertionError):
                test_class().runTest()
    except Exception:
        print_unicode(o.getvalue())
        raise
    v = o.getvalue()
    print_unicode(v)
    steps = [l for l in v.splitlines() if 'Step ' in l or 'state.' in l]
    assert 1 <= len(steps) <= 50
Пример #3
0
def test_bad_machines_fail(machine):
    test_class = machine.TestCase
    try:
        with capture_out() as o:
            with raises(AssertionError):
                test_class().runTest()
    except Exception:
        print_unicode(o.getvalue())
        raise
    v = o.getvalue()
    print_unicode(v)
    steps = [l for l in v.splitlines() if 'Step ' in l or 'state.' in l]
    assert 1 <= len(steps) <= 50
Пример #4
0
def test_bad_machines_fail(machine):
    test_class = machine.TestCase
    try:
        with capture_out() as o:
            with raises(AssertionError):
                test_class().runTest()
    except Exception:
        print_unicode(o.getvalue())
        raise
    v = o.getvalue()
    print_unicode(v)
    assert u'Step #1' in v
    assert u'Step #50' not in v
def test_prints_note_in_failing_example():
    @example(x=42)
    @example(x=43)
    @given(integers())
    def test(x):
        note("x -> %d" % (x,))
        assert x == 42

    with capture_out() as out:
        with reporting.with_reporter(reporting.default):
            with pytest.raises(AssertionError):
                test()
    v = out.getvalue()
    print_unicode(v)
    assert "x -> 43" in v
    assert "x -> 42" not in v
Пример #6
0
 def myfunc(self, data):
     print_unicode(data)
Пример #7
0
 def myfunc(self, data):
     print_unicode(data)
 def test(x):
     print_unicode(u"x -> %d" % (x,))
Пример #9
0
def default(value):
    try:
        print_unicode(value)
    except UnicodeEncodeError:
        print_unicode(escape_unicode_characters(value))
Пример #10
0
def default(value):
    try:
        print_unicode(value)
    except UnicodeEncodeError:
        print_unicode(escape_unicode_characters(value))