in Python by
What all nose testing tools exist in Python?

▼ Show 1 Answer

0 votes
nose contains few methods and tools useful for test automation, in module.

nose has it's own assert method i.e assert_equals in

Usage of assert_equals is shown in below example by modifying definition of test_sample_nosetest in

def test_sample_nose1test():


Usage of OK_ and EQ_ also contain methods ok_ and eq_, which function similar to assert and assert_equals respectively.

You can optionally pass an error message that can be displayed when a test fails.

Usage of ok_ and eq_ is shown in below example by defining two functions in

from import ok_, eq_

def test_using_ok():


def test_using_eq():

    eq_(2+3, 5)

Usage of 'raises' decorator

raises decorator is used to decorate those tests, which are expected to raise an Exception.

The test will be successful only if the exception raised is present in list of exceptions passed to raises decorator.

A sample test added to is shown below.

from import raises


def test_using_raises():

    eq_(2+'3', 5)
Learn More with Madanswer

Related questions

0 votes
0 votes
asked Jul 2, 2020 in Python by GeorgeBell