def test_Utilities__test_2():
    """If the above is not met, and there is an extra argument
    it returns it."""
    assert test(False, 1, False, 2, 3) == 3
    assert test(False, 1, 2) == 2
    assert test(1) == 1
    assert not test(False)
Пример #2
0
def test_test_single_value_true():
    from RestrictedPython.Utilities import test
    assert test(True) is True
Пример #3
0
def test_test_odd_values_last_false():
    from RestrictedPython.Utilities import test
    assert test(False, 'first', False, 'second', False) is False
Пример #4
0
def test_test_odd_values_last_true():
    from RestrictedPython.Utilities import test
    assert test(False, 'first', False, 'second', 'third') == 'third'
Пример #5
0
def test_test_odd_values_not_first_true():
    from RestrictedPython.Utilities import test
    assert test(False, 'first', True, 'second', False) == 'second'
Пример #6
0
def test_test_even_values_first_true():
    from RestrictedPython.Utilities import test
    assert test(True, 'first', True, 'second') == 'first'
Пример #7
0
def test_test_single_value_False():
    from RestrictedPython.Utilities import test
    assert test(False) is False
Пример #8
0
 def test_test_odd_values_last_false(self):
     from RestrictedPython.Utilities import test
     self.assertEqual(test(False, 'first', False, 'second', False), False)
Пример #9
0
 def test_test_odd_values_first_true(self):
     from RestrictedPython.Utilities import test
     self.assertEqual(test(True, 'first', True, 'second', False), 'first')
Пример #10
0
 def test_test_even_values_not_first_true(self):
     from RestrictedPython.Utilities import test
     self.assertEqual(test(False, 'first', True, 'second'), 'second')
Пример #11
0
 def test_test_single_value_False(self):
     from RestrictedPython.Utilities import test
     self.failIf(test(False))
Пример #12
0
 def test_test_single_value_true(self):
     from RestrictedPython.Utilities import test
     self.failUnless(test(True))
Пример #13
0
 def test(self, *args):
     return test(*args)
Пример #14
0
def test_Utilities__test_1():
    """It returns the first arg after the first argument which is True"""
    assert test(True, 1, False, 2) == 1
    assert test(False, 1, True, 2) == 2
    assert test(False, 1, False, 2, True, 3) == 3
Пример #15
0
def test_Utilities__test_3():
    """It returns None if there are only False args followed by something."""
    assert test(False, 1) is None
    assert test(False, 1, False, 2) is None
Пример #16
0
 def test(self, *args):
     return test(*args)