def test_maps(self): try: maps = nis.maps() except nis.error as msg: # NIS is probably not active, so this test isn't useful if support.verbose: print("Test Skipped:", msg) # Can't raise TestSkipped as regrtest only recognizes the exception # import time. return try: # On some systems, this map is only accessible to the # super user maps.remove("passwd.adjunct.byname") except ValueError: pass done = 0 for nismap in maps: mapping = nis.cat(nismap) for k, v in mapping.items(): if not k: continue if nis.match(k, nismap) != v: self.fail("NIS match failed for key `%s' in map `%s'" % (k, nismap)) else: # just test the one key, otherwise this test could take a # very long time done = 1 break if done: break
def test_maps(self): try: maps = nis.maps() except nis.error, msg: # NIS is probably not active, so this test isn't useful if test_support.verbose: print "Test Skipped:", msg # Can't raise TestSkipped as regrtest only recognizes the exception # import time. return
def _get(self, name, retrieve=1): if not name: return self elif str(name) in nis.maps(): return nisMapContext( namingAuthority = self.namingAuthority, nameInContext = self.nameInContext + name, ) else: return NOT_FOUND
from test_support import verbose, TestFailed, TestSkipped import nis print 'nis.maps()' try: maps = nis.maps() except nis.error, msg: # NIS is probably not active, so this test isn't useful if verbose: raise TestFailed, msg # only do this if running under the regression suite raise TestSkipped, msg done = 0 for nismap in maps: if verbose: print nismap mapping = nis.cat(nismap) for k, v in mapping.items(): if verbose: print ' ', k, v if not k: continue if nis.match(k, nismap) <> v: print "NIS match failed for key `%s' in map `%s'" % (k, nismap) else: # just test the one key, otherwise this test could take a # very long time done = 1 break if done:
def __iter__(self): for map in nis.maps(): yield self.compoundParser(map)
print AP2.O_SHLOCK, AP2.O_EXLOCK #pylint: disable-msg=E1101 print AP3.rpc_paths #pylint: disable-msg=E1101 print AP4.rpc_paths print AP5.subversion print AP6.family print AP6.type print AP6.proto print heapq.nsmallest(1, ['a', 'b'], key=lambda x: 'your mom') print heapq.nlargest(1, ['a', 'b'], key=lambda x: 'your mom') print min([], key=lambda x: 'your mom') print max([], key=lambda x: 'your mom') print match('foo', domain='lalala') print maps('foo', domain='lalala') webbrowser.open(autoraise=True) ######### This is not detectable using pylint machinery, I think. # try: # print 'foo' # except IOError, e: # print 'bar' # else: # print 'baz' # finally: # print 'zoinks' ######### This crashes pylint, so... no. # def generator_func(): # while (yield 'Give me a cookie') != 'cookie':
from test_support import verbose, TestFailed, TestSkipped import nis print 'nis.maps()' try: maps = nis.maps() except nis.error, msg: # NIS is probably not active, so this test isn't useful if verbose: raise TestFailed, msg # only do this if running under the regression suite raise TestSkipped, msg done = 0 for nismap in maps: if verbose: print nismap mapping = nis.cat(nismap) for k, v in mapping.items(): if verbose: print ' ', k, v if not k: continue if nis.match(k, nismap) != v: print "NIS match failed for key `%s' in map `%s'" % (k, nismap) else: # just test the one key, otherwise this test could take a # very long time done = 1 break if done: break