buildframework/helium/tools/common/python/lib/test/test_unittestadditions.py
changeset 179 d8ac696cc51f
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
       
     1 #============================================================================ 
       
     2 #Name        : test_unittestadditions.py 
       
     3 #Part of     : Helium 
       
     4 
       
     5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     6 #All rights reserved.
       
     7 #This component and the accompanying materials are made available
       
     8 #under the terms of the License "Eclipse Public License v1.0"
       
     9 #which accompanies this distribution, and is available
       
    10 #at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 #
       
    12 #Initial Contributors:
       
    13 #Nokia Corporation - initial contribution.
       
    14 #
       
    15 #Contributors:
       
    16 #
       
    17 #Description:
       
    18 #===============================================================================
       
    19 import unittest
       
    20 from unittestadditions import skip
       
    21 
       
    22 class TestSkipDecorator(unittest.TestCase):
       
    23 
       
    24     def test_skip_false(self):
       
    25         """ A skip(False) decorated function is executed properly """
       
    26         @skip(False)
       
    27         def func(data):
       
    28             return data
       
    29         
       
    30         assert func("test") == "test"
       
    31     
       
    32     def test_skip_true(self):
       
    33         """ A skip(True) decorated function is executed properly """
       
    34         @skip(True)
       
    35         def func(data):
       
    36             return data
       
    37         
       
    38         assert func("test") == None
       
    39 
       
    40 
       
    41     def test_skip_true_default_return(self):
       
    42         """ A skip(True, 'some return value') decorated function is executed properly """
       
    43         @skip(True, "stub")
       
    44         def func(data):
       
    45             return data
       
    46         
       
    47         assert func("test") == "stub"