示例#1
0
 def __init__ (self, testcases):
     """
     Constructs a DQTestSuite instance.
     
     @since: 0.3.0
     
     @param testcases: testcases to run.
     @type testcases: list
     
     @warning:
         you have to always explicitely delete the test suite object [del(suite)],
         when using Oracle instances,
         so that the database pool monitoring thread is stopped.
     """
     TestSuite.__init__(self)
     
     for eachTestCase in testcases:
         for method in dir(eachTestCase):
             lmethod = method.lower()
             if lmethod.startswith('test') or \
                 lmethod.startswith('alternative') or \
                 lmethod.startswith('scenario') or \
                 lmethod.startswith('attempt'):
                 """method name starts by 'test': add it to the test suite"""
                 self.addTest(eachTestCase(method))
示例#2
0
 def __post_init__(Discover):
     from importlib import import_module
     TestSuite.__init__(Discover)
     if isinstance(Discover.module, str):
         Discover.module = import_module(Discover.module)
     if not Discover._tests:
         Discover.discover()
示例#3
0
 def __init__(self, name, module_name):
     TestSuite.__init__(self, [])
     self.name = name
     self.test_classes = list()
     suite_module = import_module(module_name)
     for (name, obj) in inspect.getmembers(suite_module):
         if inspect.isclass(obj) and issubclass(
                 obj, EZTestCase) and obj is not EZTestCase:
             self.test_classes.append(obj)
示例#4
0
 def __init__(self):
     BaseSuite.__init__(self)
     self._test_cases = {
         'test_system': SystemTest,
         'test_history': HistoryTest,
         'test_wallet': WalletTest,
         'test_assets': AssetsTest,
         'test_orders': OrdersTest,
         'test_futures': FuturesTest
     }
     self._instantate()
示例#5
0
    def __init__(self):
        TestSuite.__init__(self)

        mixed_tests = [
            {'name': 'Enumerable',
             'raw_limit': rr.RawLimit([1, 2.25], [5, 4.75], [3, 3.5], [3, 4.4], [[5, 5.5], [6.1]])},
            {'name': 'Dictionary',
             'raw_limit': rr.RawLimit({'b': 2.25, 'a': 1}, {'a': 5, 'b': 4.75}, {'b': 3.5, 'a': 3},
                                      [3, 4.4], {'a': [5, 5.5], 'b': [6.1]})},
            {'name': 'EnumKeys',
             'raw_limit': rr.RawLimit([1, 2.25], [5, 4.75], [3, 3.5], [3, 4.4], [[5, 5.5], [6.1]])},
            {'name': 'DictKeys',
             'raw_limit': rr.RawLimit({'b': 2.25, 'a': 1}, {'a': 5, 'b': 4.75}, {'b': 3.5, 'a': 3},
                                      [3, 4.4], {'a': [5, 5.5], 'b': [6.1]}, ['b', 'a'])},
            {'name': 'NoDefault',
             'raw_limit': rr.RawLimit([1, 2.25], [5, 4.75], None, [3, 4.4], [[5, 5.5], [6.1]])},
            {'name': 'NoCommon',
             'raw_limit': rr.RawLimit([1, 2.25], [5, 4.75], [3, 3.5], None, [[3, 4.4, 5, 5.5], [3, 4.4, 6.1]])},
            {'name': 'NoIndividual',
             'raw_limit': rr.RawLimit([1, 2.25], [5, 4.75], [3, 3.5], [3, 4.4, 5, 5.5, 6.1])},
        ]

        for test in mixed_tests:
            self.add_test(test, TestLimitImport)

        same_tests = [
            {'name': 'EnumBase', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4, 5, 5.5], value_keys=[1, 0])},
            {'name': 'EnumCount', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4, 5, 5.5], value_keys=2)},
            {'name': 'EnumNoDef', 'raw_limit': rr.RawLimit(2.25, 4.75, None, [3, 4.4, 5, 5.5], value_keys=[1, 0])},
            {'name': 'EnumMin', 'raw_limit': rr.RawLimit([2.25, 2.25], 4.75, 3.5, [3, 4.4, 5, 5.5])},
            {'name': 'EnumMax', 'raw_limit': rr.RawLimit(2.25, [4.75, 4.75], 3.5, [3, 4.4, 5, 5.5])},
            {'name': 'EnumDef', 'raw_limit': rr.RawLimit(2.25, 4.75, [3.5, 3.5], [3, 4.4, 5, 5.5])},
            {'name': 'EnumFix', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4], [[5, 5.5], [5, 5.5]])},
            {'name': 'DictBase', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4, 5, 5.5], value_keys=['b', 'a'])},
            {'name': 'DictNoDef', 'raw_limit': rr.RawLimit(2.25, 4.75, None, [3, 4.4, 5, 5.5], value_keys=['b', 'a'])},
            {'name': 'DictMin', 'raw_limit': rr.RawLimit({'a': 2.25, 'b': 2.25}, 4.75, 3.5, [3, 4.4, 5, 5.5])},
            {'name': 'DictMax', 'raw_limit': rr.RawLimit(2.25, {'a': 4.75, 'b': 4.75}, 3.5, [3, 4.4, 5, 5.5])},
            {'name': 'DictDef', 'raw_limit': rr.RawLimit(2.25, 4.75, {'a': 3.5, 'b': 3.5}, [3, 4.4, 5, 5.5])},
            {'name': 'DictFix', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4], {'b': [5, 5.5], 'a': [5, 5.5]})},
        ]

        for test in same_tests:
            self.add_test(test, TestSameLimitImport)

        scalar_tests = [
            {'name': 'ScalarKey', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4, 5, 5.5], value_keys=[0])},
            {'name': 'ScalarCount', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4, 5, 5.5], value_keys=1)},
            {'name': 'ScalarBase', 'raw_limit': rr.RawLimit(2.25, 4.75, 3.5, [3, 4.4, 5, 5.5])},
            {'name': 'ScalarNoDef', 'raw_limit': rr.RawLimit(2.25, 4.75, None, [3, 4.4, 5, 5.5])},
        ]

        for test in scalar_tests:
            self.add_test(test, TestScalarLimitImport)
示例#6
0
 def __init__( self, marshaller_test_case_type ):
     TestSuite.__init__( self )
     self.addTest( marshaller_test_case_type( BooleanStruct( True ) ) )
     self.addTest( marshaller_test_case_type( BooleanStruct( False ) ) )
     self.addTest( marshaller_test_case_type( EmptyStruct() ) )    
     self.addTest( marshaller_test_case_type( FloatStruct( -1.0 ) ) )
     self.addTest( marshaller_test_case_type( FloatStruct( 0.0 ) ) )
     self.addTest( marshaller_test_case_type( FloatStruct( 1.0 ) ) )
     self.addTest( marshaller_test_case_type( DoubleStruct( -1.0 ) ) )
     self.addTest( marshaller_test_case_type( DoubleStruct( 0.0 ) ) )
     self.addTest( marshaller_test_case_type( DoubleStruct( 1.0 ) ) )
     self.addTest( marshaller_test_case_type( Int32Struct( -1 ) ) )
     self.addTest( marshaller_test_case_type( Int32Struct( 0 ) ) )
     self.addTest( marshaller_test_case_type( Int32Struct( 1 ) ) )
     self.addTest( marshaller_test_case_type( Int64Struct( -1 ) ) )
     self.addTest( marshaller_test_case_type( Int64Struct( 0 ) ) )
     self.addTest( marshaller_test_case_type( Int64Struct( 1 ) ) )
     self.addTest( marshaller_test_case_type( StringStruct( "" ) ) )
     self.addTest( marshaller_test_case_type( StringStruct( "test" ) ) )
     self.addTest( marshaller_test_case_type( StringSetStruct( "a", "b" ) ) )
示例#7
0
    def __init__(self, single_test=None):
        TestSuite.__init__(self)

        class P4Metric(rr.PMetric):
            def __init__(self, *args, **kwargs):
                super().__init__(4, *args, **kwargs)

        metric_tests = [single_test] if single_test is not None else [
            {
                'metric_class': rr.SumMetric,
                'unweighted_distance': 7,
                'weighted_distance': 16
            },
            {
                'metric_class': rr.EuclidianMetric,
                'unweighted_distance': 5,
                'weighted_distance': 12.649110640673518
            },
            {
                'metric_class': rr.CubicMetric,
                'unweighted_distance': 4.497941445,
                'weighted_distance': 12.1463558875027
            },
            {
                'metric_class': P4Metric,
                'unweighted_distance': 4.28457229495381,
                'weighted_distance': 12.0368667937382
            },
            {
                'metric_class': rr.MaxMetric,
                'unweighted_distance': 4,
                'weighted_distance': 12
            },
        ]

        for test in metric_tests:
            self.add_test(test)
示例#8
0
    def __init__(self, single_test=None):
        TestSuite.__init__(self)

        class CurrentFixed(rr_approach.Fixed):
            fixed_value = 42

        # TODO one more 2D-test for meaningful affine hull would be nice
        approach_tests = [single_test] if single_test is not None else [
            {'approach_class': CurrentFixed, 'scalar_result_1': array([42]), 'scalar_result_2': array([42]),
             'vector_result_1': array([42, 42]), 'vector_result_2': array([42, 42])},
            {'approach_class': rr.NearestNeighbor, 'scalar_result_1': array([2]), 'scalar_result_2': array([2.2]),
             'vector_result_1': array([2, 2]), 'vector_result_2': array([3, -1])},
            {'approach_class': rr.FirstDerivative, 'scalar_result_1': array([3.5]), 'scalar_result_2': array([2.56]),
             'vector_result_1': array([6, 9]), 'vector_result_2': array([2.7, -0.85])},
            {'approach_class': rr.SecondDerivative, 'scalar_result_1': array([4]), 'scalar_result_2': array([2.584]),
             'vector_result_1': array([12, 17.25]), 'vector_result_2': array([2.853125, -0.81875])},
            {'approach_class': rr.AffineHull, 'scalar_result_1': array([2]), 'scalar_result_2': array([2.25]),
             'vector_result_1': array([2, 2]), 'vector_result_2': array([3, -1])},
            {'approach_class': rr.WeightedSumApproach, 'scalar_result_1': array([2]), 'scalar_result_2': array([13/6]),
             'vector_result_1': array([2, 2]), 'vector_result_2': array([2.7597469, -0.2792408])},
        ]

        for test in approach_tests:
            self.add_test(test)
示例#9
0
 def __init__(self, tests=()):
     self.flags = {}
     if tests:
         TestSuite.__init__(self, tests)
     else:
         TestSuite.__init__(self)
示例#10
0
 def __init__(self, name_indexed_tests):
     self.invert_test_indexing(name_indexed_tests)
     TestSuite.__init__(self, self.test_name.keys())
示例#11
0
 def __init__(self, tests=(), testProgram=None):
     if callable(tests):
         tests = tests()
     log.debug("CTestTestSuite.__init__(self, %s)", repr(tests))
     TestSuite.__init__(self, tests)
     self.testProgram = testProgram
示例#12
0
 def __init__(self, name_indexed_tests):
     self.invert_test_indexing(name_indexed_tests)
     TestSuite.__init__(self, self.test_name.keys())