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)