#NEWLINE# def test_getparent( self , testdir ) : #NEWLINE# #INDENT# modcol = testdir . getmodulecol ( '\n            class TestClass:\n                 def test_foo():\n                     pass\n        ' ) #NEWLINE# cls = testdir . collect_by_name ( modcol , 'TestClass' ) #NEWLINE# fn = testdir . collect_by_name ( testdir . collect_by_name ( cls , '()' ) , 'test_foo' ) #NEWLINE# parent = fn . getparent ( pytest . Module ) #NEWLINE# assert ( parent is modcol ) #NEWLINE# parent = fn . getparent ( pytest . Function ) #NEWLINE# assert ( parent is fn ) #NEWLINE# parent = fn . getparent ( pytest . Class ) #NEWLINE# assert ( parent is fn )