diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /python/macholib/macholib_tests/test_framework.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'python/macholib/macholib_tests/test_framework.py')
-rw-r--r-- | python/macholib/macholib_tests/test_framework.py | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/python/macholib/macholib_tests/test_framework.py b/python/macholib/macholib_tests/test_framework.py new file mode 100644 index 000000000..8c123afd0 --- /dev/null +++ b/python/macholib/macholib_tests/test_framework.py @@ -0,0 +1,88 @@ +from macholib import framework + +import sys +if sys.version_info[:2] <= (2,6): + import unittest2 as unittest +else: + import unittest + + +class TestFramework (unittest.TestCase): + def test_framework(self): + self.assertEqual( + framework.framework_info('Location/Name.framework/Versions/SomeVersion/Name_Suffix'), + dict( + location='Location', + name='Name.framework/Versions/SomeVersion/Name_Suffix', + shortname='Name', + version='SomeVersion', + suffix='Suffix', + )) + self.assertEqual( + framework.framework_info('Location/Name.framework/Versions/SomeVersion/Name'), + dict( + location='Location', + name='Name.framework/Versions/SomeVersion/Name', + shortname='Name', + version='SomeVersion', + suffix=None, + )) + self.assertEqual( + framework.framework_info('Location/Name.framework/Name_Suffix'), + dict( + location='Location', + name='Name.framework/Name_Suffix', + shortname='Name', + version=None, + suffix='Suffix', + )) + self.assertEqual( + framework.framework_info('Location/Name.framework/Name'), + dict( + location='Location', + name='Name.framework/Name', + shortname='Name', + version=None, + suffix=None + )) + self.assertEqual( + framework.framework_info('Location/Name.framework.disabled/Name'), + None + ) + self.assertEqual( + framework.framework_info('Location/Name.framework/Versions/A/B/Name'), + None + ) + self.assertEqual( + framework.framework_info('Location/Name.framework/Versions/A'), + None + ) + self.assertEqual( + framework.framework_info('Location/Name.framework/Versions/A/Name/_debug'), + None + ) + + def test_interal_tests(self): + # Ported over from the source file + def d(location=None, name=None, shortname=None, version=None, suffix=None): + return dict( + location=location, + name=name, + shortname=shortname, + version=version, + suffix=suffix + ) + self.assertEqual(framework.framework_info('completely/invalid'), None) + self.assertEqual(framework.framework_info('completely/invalid/_debug'), None) + self.assertEqual(framework.framework_info('P/F.framework'), None) + self.assertEqual(framework.framework_info('P/F.framework/_debug'), None) + self.assertEqual(framework.framework_info('P/F.framework/F'), d('P', 'F.framework/F', 'F')) + self.assertEqual(framework.framework_info('P/F.framework/F_debug'), d('P', 'F.framework/F_debug', 'F', suffix='debug')) + self.assertEqual(framework.framework_info('P/F.framework/Versions'), None) + self.assertEqual(framework.framework_info('P/F.framework/Versions/A'), None) + self.assertEqual(framework.framework_info('P/F.framework/Versions/A/F'), d('P', 'F.framework/Versions/A/F', 'F', 'A')) + self.assertEqual(framework.framework_info('P/F.framework/Versions/A/F_debug'), d('P', 'F.framework/Versions/A/F_debug', 'F', 'A', 'debug')) + + +if __name__ == "__main__": + unittest.main() |