test_util.py 879 B

12345678910111213141516171819202122
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this
  3. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. import unittest
  5. from cuddlefish.manifest import filter_filenames, filter_dirnames
  6. class Filter(unittest.TestCase):
  7. def test_filter_filenames(self):
  8. names = ["foo", "bar.js", "image.png",
  9. ".hidden", "foo~", ".foo.swp", "bar.js.swp"]
  10. self.failUnlessEqual(sorted(filter_filenames(names)),
  11. sorted(["foo", "bar.js", "image.png"]))
  12. def test_filter_dirnames(self):
  13. names = ["subdir", "data", ".git", ".hg", ".svn", "defaults"]
  14. self.failUnlessEqual(sorted(filter_dirnames(names)),
  15. sorted(["subdir", "data", "defaults"]))
  16. if __name__ == '__main__':
  17. unittest.main()