

def testEmptySourceData(self):
    test_data = '# comment 1\n# deb http://security.debian.org/ wheezy/updates main\nURI :\nURI:\n# Trailing whitespace on purpose\nURI:          \n\nURIs :\nURIs:\n# Trailing whitespace on purpose\nURIs:        \n# comment 2\n'
    file_obj = StringIO.StringIO(test_data)
    pathspec = rdf_paths.PathSpec(path='/etc/apt/sources.list.d/test.list')
    stat = rdf_client.StatEntry(pathspec=pathspec)
    parser = config_file.APTPackageSourceParser()
    results = list(parser.Parse(stat, file_obj, None))
    result = [d for d in results if isinstance(d, rdf_protodict.AttributedDict)][0]
    self.assertEqual('/etc/apt/sources.list.d/test.list', result.filename)
    self.assertEqual(0, len(result.uris))

dataset/ETHPy150Open google/grr/grr/parsers/config_file_test.py APTPackageSourceParserTests.testEmptySourceData/original