/usr/lib/python2.7/dist-packages/vamos/rsf2model/RsfReader_test.py is in undertaker 1.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #!/usr/bin/env python
#
# rsf2model - extracts presence implications from kconfig dumps
#
# Copyright (C) 2011 Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest as t
import StringIO
from vamos.rsf2model import RsfReader
class TestRsfReader(t.TestCase):
def setUp(self):
rsf = """Item A 'boolean'
Item B tristate
ItemFoo B some_value
Item C boolean
Item H hex
Item S string
CRAP CARASDD"""
self.rsf = RsfReader.RsfReader(StringIO.StringIO(rsf))
def test_correct_options(self):
opts = set()
for name in self.rsf.options():
opt = self.rsf.options()[name]
if opt.name == "A":
opts.add("A")
self.assertEqual(opt.tristate(), False, "Item state wrong parsed")
if opt.name == "B":
opts.add("B")
self.assertEqual(opt.tristate(), True, "Item state wrong parsed")
if opt.name == "C":
opts.add("C")
self.assertEqual(opt.tristate(), False, "Item state wrong parsed")
if opt.name == "H":
opts.add("H")
self.assertEqual(opt.hex(), True, "Item state wrong")
if opt.name == "S":
opts.add("S")
self.assertEqual(opt.string(), True, "Item state wrong")
def test_symbol_generation(self):
self.assertEqual(self.rsf.options()["A"].symbol(), "CONFIG_A")
self.assertRaises(RsfReader.OptionNotTristate, self.rsf.options()["A"].symbol_module)
self.assertEqual(self.rsf.options()["B"].symbol_module(), "CONFIG_B_MODULE")
self.assertEqual(self.rsf.options()["S"].symbol(), "CONFIG_S")
self.assertEqual(self.rsf.options()["H"].symbol(), "CONFIG_H")
if __name__ == '__main__':
t.main()
|