Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
def test_test_single_value_true():
    from RestrictedPython.Utilities import test
    assert test(True) is True
Ejemplo n.º 3
0
def test_test_odd_values_last_false():
    from RestrictedPython.Utilities import test
    assert test(False, 'first', False, 'second', False) is False
Ejemplo n.º 4
0
def test_test_odd_values_last_true():
    from RestrictedPython.Utilities import test
    assert test(False, 'first', False, 'second', 'third') == 'third'
Ejemplo n.º 5
0
def test_test_odd_values_not_first_true():
    from RestrictedPython.Utilities import test
    assert test(False, 'first', True, 'second', False) == 'second'
Ejemplo n.º 6
0
def test_test_even_values_first_true():
    from RestrictedPython.Utilities import test
    assert test(True, 'first', True, 'second') == 'first'
Ejemplo n.º 7
0
def test_test_single_value_False():
    from RestrictedPython.Utilities import test
    assert test(False) is False
Ejemplo n.º 8
0
 def test_test_odd_values_last_false(self):
     from RestrictedPython.Utilities import test
     self.assertEqual(test(False, 'first', False, 'second', False), False)
Ejemplo n.º 9
0
 def test_test_odd_values_first_true(self):
     from RestrictedPython.Utilities import test
     self.assertEqual(test(True, 'first', True, 'second', False), 'first')
Ejemplo n.º 10
0
 def test_test_even_values_not_first_true(self):
     from RestrictedPython.Utilities import test
     self.assertEqual(test(False, 'first', True, 'second'), 'second')
Ejemplo n.º 11
0
 def test_test_single_value_False(self):
     from RestrictedPython.Utilities import test
     self.failIf(test(False))
Ejemplo n.º 12
0
 def test_test_single_value_true(self):
     from RestrictedPython.Utilities import test
     self.failUnless(test(True))
Ejemplo n.º 13
0
 def test(self, *args):
     return test(*args)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 16
0
 def test(self, *args):
     return test(*args)