def setUp(self): TestCase.setUp(self) TestHelper.setUp(self) self.threadpool = FakeThreadPool() self.transaction = self.mocker.mock() self.transactor = Transactor(self.threadpool, self.transaction) self.function = self.mocker.mock()
def setUp(self): super().setUp() one_entity_file_path = ( 'tests/samples/proposed/raw_field_selection_one_entity.yaml') self.highest_score_argument = TestHelper.prepare_dimension_argument( dimension=RawFieldSelection, proposed_path=one_entity_file_path, solution_path=one_entity_file_path) empty_file_path = 'tests/samples/empty.yaml' self.none_score_argument = TestHelper.prepare_dimension_argument( dimension=RawFieldSelection, proposed_path=empty_file_path, solution_path=empty_file_path) self.lowest_score_argument = TestHelper.prepare_dimension_argument( dimension=RawFieldSelection, proposed_path=empty_file_path, solution_path=one_entity_file_path) two_entities_file_path = ( 'tests/samples/proposed/raw_field_selection_two_entities.yaml') self.middling_score_argument = TestHelper.prepare_dimension_argument( dimension=RawFieldSelection, proposed_path=one_entity_file_path, solution_path=two_entities_file_path)
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "table" prop1 = Property("column1", primary=True) self.Class = Class self.ClassAlias = ClassAlias(self.Class, "alias")
def setUp(self): super().setUp() one_entity_file_path = ( 'tests/samples/proposed/unit_mapping_one_entity.yaml') self.highest_score_argument = TestHelper.prepare_dimension_argument( dimension=UnitMapping, proposed_path=one_entity_file_path, solution_path=one_entity_file_path) empty_file_path = 'tests/samples/empty.yaml' self.none_score_argument = TestHelper.prepare_dimension_argument( dimension=UnitMapping, proposed_path=empty_file_path, solution_path=empty_file_path) self.lowest_score_argument = TestHelper.prepare_dimension_argument( dimension=UnitMapping, proposed_path=empty_file_path, solution_path=one_entity_file_path) two_entities_file_path = ( 'tests/samples/proposed/unit_mapping_two_entities.yaml') self.middling_score_argument = TestHelper.prepare_dimension_argument( dimension=UnitMapping, proposed_path=one_entity_file_path, solution_path=two_entities_file_path)
def setUp(self): TestHelper.setUp(self) self.executed = [] self.database = Database() self.raw_connection = RawConnection(self.executed) self.database.raw_connect = lambda: self.raw_connection self.connection = Connection(self.database)
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "table" prop1 = Property("column1", primary=True) prop2 = Property("column2") self.Class = Class self.cls_info = get_cls_info(Class)
def run(data): helper = TestHelper(data) if not helper.is_empty(): print('Data is not empty.') return TestHelper.FAIL_CODE return TestHelper.SUCCESS_CODE
def setUp(self): TestHelper.setUp(self) self.db_module = new.module("db_module") self.uri = None def create_from_uri(uri): self.uri = uri return "RESULT" self.db_module.create_from_uri = create_from_uri sys.modules["storm.databases.db_module"] = self.db_module
def run(data): helper = TestHelper(data) try: helper.is_io_correct(5, 1, 1, 0) except TestHelperException as e: print(e.msg) return TestHelper.FAIL_CODE return TestHelper.SUCCESS_CODE
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "mytable" prop1 = Custom("column1", primary=True) prop2 = Custom() prop3 = Custom("column3", default=50, allow_none=False) class SubClass(Class): __storm_table__ = "mysubtable" self.Class = Class self.SubClass = SubClass
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "table" prop1 = Property("column1", primary=True) prop2 = Property("column2") self.Class = Class self.obj = Class() self.obj_info = get_obj_info(self.obj) self.cls_info = get_cls_info(Class) self.variable1 = self.obj_info.variables[Class.prop1] self.variable2 = self.obj_info.variables[Class.prop2]
def setUp(self): TestHelper.setUp(self) # Allow classes with the same name in different tests to resolve # property path strings properly. SQLObjectBase._storm_property_registry.clear() self.store = Store(create_database("sqlite:")) class SQLObject(SQLObjectBase): @staticmethod def _get_store(): return self.store self.SQLObject = SQLObject self.store.execute("CREATE TABLE person " "(id INTEGER PRIMARY KEY, name TEXT, age INTEGER," " ts TIMESTAMP, delta INTERVAL," " address_id INTEGER)") self.store.execute("INSERT INTO person VALUES " "(1, 'John Joe', 20, '2007-02-05 19:53:15'," " '1 day, 12:34:56', 1)") self.store.execute("INSERT INTO person VALUES " "(2, 'John Doe', 20, '2007-02-05 20:53:15'," " '42 days 12:34:56.78', 2)") self.store.execute("CREATE TABLE address " "(id INTEGER PRIMARY KEY, city TEXT)") self.store.execute("INSERT INTO address VALUES (1, 'Curitiba')") self.store.execute("INSERT INTO address VALUES (2, 'Sao Carlos')") self.store.execute("CREATE TABLE phone " "(id INTEGER PRIMARY KEY, person_id INTEGER," "number TEXT)") self.store.execute("INSERT INTO phone VALUES (1, 2, '1234-5678')") self.store.execute("INSERT INTO phone VALUES (2, 1, '8765-4321')") self.store.execute("INSERT INTO phone VALUES (3, 2, '8765-5678')") self.store.execute("CREATE TABLE person_phone " "(id INTEGER PRIMARY KEY, person_id INTEGER, " "phone_id INTEGER)") self.store.execute("INSERT INTO person_phone VALUES (1, 2, 1)") self.store.execute("INSERT INTO person_phone VALUES (2, 2, 2)") self.store.execute("INSERT INTO person_phone VALUES (3, 1, 1)") class Person(self.SQLObject): _defaultOrder = "-Person.name" name = StringCol() age = IntCol() ts = UtcDateTimeCol() self.Person = Person
def run(data): helper = TestHelper(data) try: value = 1 for t in range(21): helper.is_io_correct(t, 0, value, 0) if value: value = 0 else: value = 1 except TestHelperException as e: print(e.msg) return TestHelper.FAIL_CODE return TestHelper.SUCCESS_CODE
def test_crazy_metaclass(self): """We don't want metaclasses playing around when we build an alias.""" TestHelper.setUp(self) class MetaClass(type): def __new__(meta_cls, name, bases, dict): cls = type.__new__(meta_cls, name, bases, dict) cls.__storm_table__ = "HAH! GOTCH YA!" return cls class Class(object): __metaclass__ = MetaClass __storm_table__ = "table" prop1 = Property("column1", primary=True) Alias = ClassAlias(Class, "USE_THIS") self.assertEquals(Alias.__storm_table__, "USE_THIS")
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "mytable" prop1 = Property("column1", primary=True) prop2 = Property() class SubClass(Class): __storm_table__ = "mysubtable" self.Class = Class self.SubClass = SubClass self.AnotherClass = type("Class", (Class, ), {}) self.registry = PropertyRegistry()
def test_crazy_metaclass(self): """We don't want metaclasses playing around when we build an alias.""" TestHelper.setUp(self) class MetaClass(type): def __new__(meta_cls, name, bases, dict): cls = type.__new__(meta_cls, name, bases, dict) cls.__storm_table__ = "HAH! GOTCH YA!" return cls class Class(with_metaclass(MetaClass, object)): __storm_table__ = "table" prop1 = Property("column1", primary=True) Alias = ClassAlias(Class, "USE_THIS") self.assertEquals(Alias.__storm_table__, "USE_THIS")
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "mytable" prop1 = Property("column1", primary=True) prop2 = Property() class SubClass(Class): __storm_table__ = "mysubtable" self.Class = Class self.SubClass = SubClass self.AnotherClass = type("Class", (Class,), {}) self.registry = PropertyRegistry()
def setUp(self): TestHelper.setUp(self) class Class(object): __storm_table__ = "mytable" prop1 = Custom("column1", primary=True, size=11, unsigned=True) prop2 = Custom() prop3 = Custom("column3", default=50, allow_none=False) prop4 = Custom( "column4", index=True, unique=True, auto_increment=True, array={'other_value': 1} ) class SubClass(Class): __storm_table__ = "mysubtable" self.Class = Class self.SubClass = SubClass
def setUp(self): super().setUp() featureful_file_path = ( 'tests/samples/proposed/entity_connection_identification.yaml') self.highest_score_argument = TestHelper.prepare_dimension_argument( dimension=EntityConnectionIdentification, proposed_path=featureful_file_path, solution_path=featureful_file_path) empty_file_path = 'tests/samples/empty.yaml' self.none_score_argument = TestHelper.prepare_dimension_argument( dimension=EntityConnectionIdentification, proposed_path=empty_file_path, solution_path=empty_file_path) no_contains_file_path = 'tests/samples/proposed/entity_connection_identification_no_contains.yaml' # pylint: disable=line-too-long self.middling_score_argument = TestHelper.prepare_dimension_argument( dimension=EntityConnectionIdentification, proposed_path=no_contains_file_path, solution_path=featureful_file_path)
def setUp(self): super().setUp() featureful_file_path = ( 'tests/samples/proposed/entity_type_identification_virtual.yaml') self.highest_score_argument = TestHelper.prepare_dimension_argument( dimension=EntityTypeIdentification, proposed_path=featureful_file_path, solution_path=featureful_file_path) empty_file_path = 'tests/samples/empty.yaml' self.none_score_argument = TestHelper.prepare_dimension_argument( dimension=EntityTypeIdentification, proposed_path=empty_file_path, solution_path=empty_file_path) reporting_entity_file_path = ( 'tests/samples/proposed/entity_type_identification_reporting.yaml') self.middling_score_argument = TestHelper.prepare_dimension_argument( dimension=EntityTypeIdentification, proposed_path=reporting_entity_file_path, solution_path=featureful_file_path)
def setUp(self): TestHelper.setUp(self) class Base(object): __metaclass__ = PropertyPublisherMeta class Class(Base): __storm_table__ = "mytable" prop1 = Property("column1", primary=True) prop2 = Property() class SubClass(Class): __storm_table__ = "mysubtable" self.Class = Class self.SubClass = SubClass class Class(Class): __module__ += ".foo" prop3 = Property("column3") self.AnotherClass = Class self.registry = Base._storm_property_registry
def tearDown(self): del sys.modules["storm.databases.db_module"] TestHelper.tearDown(self)
def setUp(self): TestHelper.setUp(self) self.executed = [] self.raw_cursor = RawCursor(executed=self.executed) self.result = Result(FakeConnection(), self.raw_cursor)
def tearDown(self): TestHelper.tearDown(self) remove_all_tracers()
def setUp(self): TestHelper.setUp(self) self.database = Database()
def tearDown(self): TestHelper.tearDown(self) EmptyResultSetTest.tearDown(self)
def setUpClass(cls): cls.helper = TestHelper() cls.balena = cls.helper.balena
def tearDown(self): if 'factory' in storm.database._database_schemes: del storm.database._database_schemes['factory'] TestHelper.tearDown(self)
def setUp(self): TestHelper.setUp(self) return DeferredStoreTest.setUp(self)
def setUp(self): TestHelper.setUp(self) self.event = EventSystem(marker)
def tearDown(self): TestHelper.tearDown(self) StoreTest.tearDown(self)
def setUp(self): TestHelper.setUp(self) EmptyResultSetTest.setUp(self)
def setUp(self): TestHelper.setUp(self) StoreTest.setUp(self)
def setUp(self): TestHelper.setUp(self) return StorePoolTest.setUp(self)
def cb(passthrough): TestHelper.tearDown(self) return passthrough