def test_import_from_parquet_retrieve_desired_data(self, mocked_create_table): mocked_create_table.return_value = 42 # import using filename rows.import_from_parquet(self.filename) args = mocked_create_table.call_args[0][0] self.assertEqual(args, DATA)
def test_import_from_parquet_uses_create_table(self, mocked_create_table): mocked_create_table.return_value = 42 kwargs = {'some_key': 123, 'other': 456, } result = rows.import_from_parquet(self.filename, **kwargs) self.assertTrue(mocked_create_table.called) self.assertEqual(mocked_create_table.call_count, 1) self.assertEqual(result, 42) call = mocked_create_table.call_args kwargs['meta'] = {'imported_from': 'parquet', 'filename': self.filename, } self.assertEqual(call[1], kwargs)
def test_import_from_parquet_uses_create_table(self, mocked_create_table): mocked_create_table.return_value = 42 kwargs = { 'some_key': 123, 'other': 456, } result = rows.import_from_parquet(self.filename, **kwargs) self.assertTrue(mocked_create_table.called) self.assertEqual(mocked_create_table.call_count, 1) self.assertEqual(result, 42) call = mocked_create_table.call_args kwargs['meta'] = { 'imported_from': 'parquet', 'filename': self.filename, } self.assertEqual(call[1], kwargs)
def test_import_from_parquet_uses_create_table(self, mocked_create_table): mocked_create_table.return_value = 42 kwargs = {'some_key': 123, 'other': 456, } result = rows.import_from_parquet(self.filename, **kwargs) self.assertTrue(mocked_create_table.called) self.assertEqual(mocked_create_table.call_count, 1) self.assertEqual(result, 42) call = mocked_create_table.call_args kwargs['force_types'] = OrderedDict([ ('nation_key', rows.fields.IntegerField), ('name', rows.fields.BinaryField), ('region_key', rows.fields.IntegerField), ('comment_col', rows.fields.BinaryField) ]) kwargs['meta'] = {'imported_from': 'parquet', 'filename': self.filename, } self.assertEqual(call[1], kwargs)
def test_import_from_parquet_uses_create_table(self, mocked_create_table): mocked_create_table.return_value = 42 kwargs = {"some_key": 123, "other": 456} result = rows.import_from_parquet(self.filename, **kwargs) self.assertTrue(mocked_create_table.called) self.assertEqual(mocked_create_table.call_count, 1) self.assertEqual(result, 42) call = mocked_create_table.call_args kwargs["force_types"] = OrderedDict( [ ("nation_key", rows.fields.IntegerField), ("name", rows.fields.BinaryField), ("region_key", rows.fields.IntegerField), ("comment_col", rows.fields.BinaryField), ] ) kwargs["meta"] = {"imported_from": "parquet", "filename": self.filename} self.assertEqual(call[1], kwargs)
def test_import_from_parquet_uses_create_table(self, mocked_create_table): mocked_create_table.return_value = 42 kwargs = {"some_key": 123, "other": 456} result = rows.import_from_parquet(self.filename, **kwargs) self.assertTrue(mocked_create_table.called) self.assertEqual(mocked_create_table.call_count, 1) self.assertEqual(result, 42) call = mocked_create_table.call_args kwargs["force_types"] = OrderedDict([ ("nation_key", rows.fields.IntegerField), ("name", rows.fields.BinaryField), ("region_key", rows.fields.IntegerField), ("comment_col", rows.fields.BinaryField), ]) kwargs["meta"] = { "imported_from": "parquet", "filename": self.filename } self.assertEqual(call[1], kwargs)