# Path: mom/os/patterns.py
# def _string_lower(string):
# def match_path_against(pathname, patterns, case_sensitive=True):
# def _match_path(pathname,
#                 included_patterns,
#                 excluded_patterns,
#                 case_sensitive=True):
# def match_path(pathname,
#                included_patterns=None,
#                excluded_patterns=None,
#                case_sensitive=True):
# def filter_paths(pathnames,
#                  included_patterns=None,
#                  excluded_patterns=None,
#                  case_sensitive=True):
# def match_any_paths(pathnames,
#                     included_patterns=None,
#                     excluded_patterns=None,
#                     case_sensitive=True):


import unittest2
from mom.os import patterns
    self.assertTrue(patterns.match_path_against(
      "/home/username/foobar/blah.py", ["*.py", "*.txt"], False))
    self.assertFalse(patterns.match_path_against(
      "/home/username/foobar/blah.py", ["*.PY", "*.txt"]))
    self.assertTrue(patterns.match_path_against(
      "/home/username/foobar/blah.py", ["*.PY", "*.txt"], False))
    self.assertFalse(patterns.match_path_against(
      "C:\\windows\\blah\\BLAH.PY", ["*.py", "*.txt"]))
    self.assertTrue(patterns.match_path_against(
      "C:\\windows\\blah\\BLAH.PY", ["*.py", "*.txt"], False))


class Test__match_path(unittest2.TestCase):
  def test_all(self):
    self.assertTrue(patterns._match_path("/users/gorakhargosh/foobar.py",
      ["*.py"], ["*.PY"]))
    self.assertFalse(patterns._match_path("/users/gorakhargosh/FOOBAR.PY",
      ["*.py"], ["*.PY"]))
    self.assertFalse(patterns._match_path("/users/gorakhargosh/foobar/",
      ["*.py"], ["*.txt"], False))

  def test_ValueError_when_conflicting_patterns(self):
    self.assertRaises(ValueError, patterns._match_path,
                      "/users/gorakhargosh/FOOBAR.PY", ["*.py"], ["*.PY"],
                      False)


class Test_match_path(unittest2.TestCase):
  def test_all(self):
    self.assertTrue(patterns.match_path("/Users/gorakhargosh/foobar.py"))

# Path: mom/os/patterns.py
# def _string_lower(string):
# def match_path_against(pathname, patterns, case_sensitive=True):
# def _match_path(pathname,
#                 included_patterns,
#                 excluded_patterns,
#                 case_sensitive=True):
# def match_path(pathname,
#                included_patterns=None,
#                excluded_patterns=None,
#                case_sensitive=True):
# def filter_paths(pathnames,
#                  included_patterns=None,
#                  excluded_patterns=None,
#                  case_sensitive=True):
# def match_any_paths(pathnames,
#                     included_patterns=None,
#                     excluded_patterns=None,
#                     case_sensitive=True):


# Path: mom/tests/test_mom_os_patterns.py
import unittest2
from mom.os import patterns

    self.assertTrue(patterns.match_path_against(
      "/home/username/foobar/blah.py", ["*.py", "*.txt"], False))
    self.assertFalse(patterns.match_path_against(
      "/home/username/foobar/blah.py", ["*.PY", "*.txt"]))
    self.assertTrue(patterns.match_path_against(
      "/home/username/foobar/blah.py", ["*.PY", "*.txt"], False))
    self.assertFalse(patterns.match_path_against(
      "C:\\windows\\blah\\BLAH.PY", ["*.py", "*.txt"]))
    self.assertTrue(patterns.match_path_against(
      "C:\\windows\\blah\\BLAH.PY", ["*.py", "*.txt"], False))


class Test__match_path(unittest2.TestCase):
  def test_all(self):
    self.assertTrue(patterns._match_path("/users/gorakhargosh/foobar.py",
      ["*.py"], ["*.PY"]))
    self.assertFalse(patterns._match_path("/users/gorakhargosh/FOOBAR.PY",
      ["*.py"], ["*.PY"]))
    self.assertFalse(patterns._match_path("/users/gorakhargosh/foobar/",
      ["*.py"], ["*.txt"], False))

  def test_ValueError_when_conflicting_patterns(self):
    self.assertRaises(ValueError, patterns._match_path,
                      "/users/gorakhargosh/FOOBAR.PY", ["*.py"], ["*.PY"],
                      False)


class Test_match_path(unittest2.TestCase):
  def test_all(self):
    self.assertTrue(patterns.match_path("/Users/gorakhargosh/foobar.py"))

    self.assertTrue(patterns.match_path("/Users/gorakhargosh/foobar.py",