3 from base_test import DakTestCase
7 from daklib.utils import extract_component_from_section
9 class ExtractComponentTestCase(DakTestCase):
12 component: main, contrib, non-free
13 section: games, admin, libs, [...]
15 [1] Order is as above.
16 [2] Prefix is optional for the default archive, but mandatory when
17 uploads are going anywhere else.
18 [3] Default component is main and may be omitted.
19 [4] Section is optional.
20 [5] Prefix is case insensitive
21 [6] Everything else is case sensitive.
24 def assertExtract(self, input, output):
26 extract_component_from_section(input)[1],
32 self.assertExtract('utils', 'main')
35 # Err, whoops? should probably be 'utils', 'main'...
36 self.assertExtract('main/utils', 'main')
39 self.assertExtract('non-free/libs', 'non-free')
42 self.assertExtract('contrib/net', 'contrib')
46 self.assertExtract('main', 'main')
49 self.assertExtract('contrib', 'contrib')
52 self.assertExtract('non-free', 'non-free')
55 # Validate #6 (section)
56 self.assertExtract('utIls', 'main')
58 if __name__ == '__main__':