<commit_before>import os
from flask import Flask, request
from flask_storage.local import LocalStorage


class BaseCase(object):
    CONFIG = {
        'TESTING': True
    }

    def setUp(self):
        self.app = self.create_app()
        self.client = self.app.test_client()

    def create_app(self):
        app = Flask(__name__)
        app.config.update(self.CONFIG)

        @app.route('/upload', methods=['POST'])
        def upload():
            image = request.files.get('image')
            return self.storage.save(image, 'flask.png')

        return app

    def upload(self):
        image = self.app.open_resource("flask.png")
        response = self.client.post('/upload', data={'image': image})
        return response


class TestLocalStorage(BaseCase):
    CONFIG = dict(
        base_dir='tmp',
        base_url='/url/'
    )
    storage = LocalStorage('local', None, CONFIG)

    def test_upload(self):
        response = self.upload()
        assert response.status_code == 200
        assert response.data == '/url/flask.png'
        assert os.path.exists('tmp/flask.png')
<commit_msg>let test case has correct base class.<commit_after>import os
import unittest

from flask import Flask, request
from flask_storage.local import LocalStorage


class BaseCase(unittest.TestCase):
    CONFIG = {
        'TESTING': True
    }

    def setUp(self):
        self.app = self.create_app()
        self.client = self.app.test_client()

    def create_app(self):
        app = Flask(__name__)
        app.config.update(self.CONFIG)

        @app.route('/upload', methods=['POST'])
        def upload():
            image = request.files.get('image')
            return self.storage.save(image, 'flask.png')

        return app

    def upload(self):
        image = self.app.open_resource("flask.png")
        response = self.client.post('/upload', data={'image': image})
        return response


class TestLocalStorage(BaseCase):
    CONFIG = dict(
        base_dir='tmp',
        base_url='/url/'
    )
    storage = LocalStorage('local', None, CONFIG)

    def test_upload(self):
        response = self.upload()
        assert response.status_code == 200
        assert response.data == '/url/flask.png'
        assert os.path.exists('tmp/flask.png')

{'fraction_non_alphanumeric': 0.12764084507042253, 'fraction_numerical': 0.002640845070422535, 'mean_word_length': 2.433534743202417, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4864037', 'n_tokens_mistral': 683, 'n_tokens_neox': 658, 'n_words': 148}