<s> from nose2 . compat import unittest <EOL> from nose2 import events , loader , session <EOL> from nose2 . plugins . loader import functions <EOL> from nose2 . tests . _common import TestCase <EOL> class TestFunctionLoader ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . session = session . Session ( ) <EOL> self . loader = loader . PluggableTestLoader ( self . session ) <EOL> self . plugin = functions . Functions ( session = self . session ) <EOL> def test_can_load_test_functions_from_module ( self ) : <EOL> class Mod ( object ) : <EOL> pass <EOL> def test ( ) : <EOL> pass <EOL> m = Mod ( ) <EOL> m . test = test <EOL> event = events . LoadFromModuleEvent ( self . loader , m ) <EOL> self . session . hooks . loadTestsFromModule ( event ) <EOL> self . assertEqual ( len ( event . extraTests ) , <NUM_LIT:1> ) <EOL> assert isinstance ( event . extraTests [ <NUM_LIT:0> ] , unittest . FunctionTestCase ) <EOL> def test_ignores_generator_functions ( self ) : <EOL> class Mod ( object ) : <EOL> pass <EOL> def test ( ) : <EOL> yield <EOL> m = Mod ( ) <EOL> m . test = test <EOL> event = events . LoadFromModuleEvent ( self . loader , m ) <EOL> self . session . hooks . loadTestsFromModule ( event ) <EOL> self . assertEqual ( len ( event . extraTests ) , <NUM_LIT:0> ) <EOL> def test_ignores_functions_that_take_args ( self ) : <EOL> class Mod ( object ) : <EOL> pass <EOL> def test ( a ) : <EOL> pass <EOL> m = Mod ( ) <EOL> m . test = test <EOL> event = events . LoadFromModuleEvent ( self . loader , m ) <EOL> self . session . hooks . loadTestsFromModule ( event ) <EOL> self . assertEqual ( len ( event . extraTests ) , <NUM_LIT:0> ) </s>
