Python operator.sequenceIncludes() Examples

The following are 13 code examples of operator.sequenceIncludes(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module operator , or try the search function .
Example #1
Source File: test_py3kwarn.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) 
Example #2
Source File: test_operator.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_contains(self):
        self.assertRaises(TypeError, operator.contains)
        self.assertRaises(TypeError, operator.contains, None, None)
        self.assertTrue(operator.contains(range(4), 2))
        self.assertFalse(operator.contains(range(4), 5))
        with test_support.check_py3k_warnings():
            self.assertTrue(operator.sequenceIncludes(range(4), 2))
            self.assertFalse(operator.sequenceIncludes(range(4), 5)) 
Example #3
Source File: test_py3kwarn.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) 
Example #4
Source File: test_operator.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_contains(self):
        self.assertRaises(TypeError, operator.contains)
        self.assertRaises(TypeError, operator.contains, None, None)
        self.assertTrue(operator.contains(range(4), 2))
        self.assertFalse(operator.contains(range(4), 5))
        with test_support.check_py3k_warnings():
            self.assertTrue(operator.sequenceIncludes(range(4), 2))
            self.assertFalse(operator.sequenceIncludes(range(4), 5)) 
Example #5
Source File: test_py3kwarn.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) 
Example #6
Source File: test_operator.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_contains(self):
        self.assertRaises(TypeError, operator.contains)
        self.assertRaises(TypeError, operator.contains, None, None)
        self.assertTrue(operator.contains(range(4), 2))
        self.assertFalse(operator.contains(range(4), 5))
        with test_support.check_py3k_warnings():
            self.assertTrue(operator.sequenceIncludes(range(4), 2))
            self.assertFalse(operator.sequenceIncludes(range(4), 5)) 
Example #7
Source File: test_py3kwarn.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) 
Example #8
Source File: test_operator.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_contains(self):
        self.assertRaises(TypeError, operator.contains)
        self.assertRaises(TypeError, operator.contains, None, None)
        self.assertTrue(operator.contains(range(4), 2))
        self.assertFalse(operator.contains(range(4), 5))
        with test_support.check_py3k_warnings():
            self.assertTrue(operator.sequenceIncludes(range(4), 2))
            self.assertFalse(operator.sequenceIncludes(range(4), 5)) 
Example #9
Source File: test_operator.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_contains(self):
        self.failUnlessRaises(TypeError, operator.contains)
        self.failUnlessRaises(TypeError, operator.contains, None, None)
        self.failUnless(operator.contains(range(4), 2))
        self.failIf(operator.contains(range(4), 5))
        self.failUnless(operator.sequenceIncludes(range(4), 2))
        self.failIf(operator.sequenceIncludes(range(4), 5)) 
Example #10
Source File: test_py3kwarn.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) 
Example #11
Source File: test_operator.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_contains(self):
        self.assertRaises(TypeError, operator.contains)
        self.assertRaises(TypeError, operator.contains, None, None)
        self.assertTrue(operator.contains(range(4), 2))
        self.assertFalse(operator.contains(range(4), 5))
        self.assertTrue(operator.sequenceIncludes(range(4), 2))
        self.assertFalse(operator.sequenceIncludes(range(4), 5)) 
Example #12
Source File: test_py3kwarn.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_operator(self):
        from operator import isCallable, sequenceIncludes

        callable_warn = ("operator.isCallable() is not supported in 3.x. "
                         "Use hasattr(obj, '__call__').")
        seq_warn = ("operator.sequenceIncludes() is not supported "
                    "in 3.x. Use operator.contains().")
        with check_py3k_warnings() as w:
            self.assertWarning(isCallable(self), w, callable_warn)
            w.reset()
            self.assertWarning(sequenceIncludes(range(3), 2), w, seq_warn) 
Example #13
Source File: test_operator.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_contains(self):
        self.assertRaises(TypeError, operator.contains)
        self.assertRaises(TypeError, operator.contains, None, None)
        self.assertTrue(operator.contains(range(4), 2))
        self.assertFalse(operator.contains(range(4), 5))
        self.assertTrue(operator.sequenceIncludes(range(4), 2))
        self.assertFalse(operator.sequenceIncludes(range(4), 5))