<commit_before>#!/usr/bin/env python3
#
# Copyright 2016 Red Hat, Inc.
#
# Authors:
#     <NAME> <<EMAIL>>
#
# This work is licensed under the MIT License.  Please see the LICENSE file or
# http://opensource.org/licenses/MIT.

import sys
import os
from patchewtest import PatchewTestCase

class ProjectTest(PatchewTestCase):

    def setUp(self):
        self.create_superuser()

    def test_empty(self):
        projects = self.get_projects()
        self.assertFalse(projects)
        self.check_cli(["project"], stdout="")

    def test_add_one_model(self):
        projects = self.get_projects()
        self.assertFalse(projects)
        name = "TestProject"
        projects = self.add_project(name)
        self.check_cli(["project"], stdout=name)

    def test_add_one_cli(self):
        projects = self.get_projects()
        self.assertFalse(projects)
        name = "TestProject"
        self.cli_login()
        self.check_cli(["project", "add", name])
        self.check_cli(["project"], stdout=name)

    def test_add_multiple_model(self):
        projects = ["TestProject-%d" % x for x in range(5)]
        for p in projects:
            self.add_project(p)
        r, a, b = self.cli(["project"])
        for p in projects:
            self.assertIn(p, a.splitlines())

    def test_add_multiple_cli(self):
        self.cli_login()
        projects = ["TestProject-%d" % x for x in range(5)]
        for p in projects:
            self.check_cli(["project", "add", p])
        r, a, b = self.cli(["project"])
        for p in projects:
            self.assertIn(p, a.splitlines())

    def test_duplicated(self):
        self.add_project("TestProject")
        self.cli_login()
        r, a, b = self.cli(["project", "add", "TestProject"])
        self.assertNotEqual(r, 0)
        self.assertNotEqual(b, "")
def main():
    import unittest
    unittest.main()<commit_msg>tests: Fix main for test_project<commit_after>#!/usr/bin/env python3
#
# Copyright 2016 Red Hat, Inc.
#
# Authors:
#     <NAME> <<EMAIL>>
#
# This work is licensed under the MIT License.  Please see the LICENSE file or
# http://opensource.org/licenses/MIT.

import sys
import os
from patchewtest import PatchewTestCase, main

class ProjectTest(PatchewTestCase):

    def setUp(self):
        self.create_superuser()

    def test_empty(self):
        projects = self.get_projects()
        self.assertFalse(projects)
        self.check_cli(["project"], stdout="")

    def test_add_one_model(self):
        projects = self.get_projects()
        self.assertFalse(projects)
        name = "TestProject"
        projects = self.add_project(name)
        self.check_cli(["project"], stdout=name)

    def test_add_one_cli(self):
        projects = self.get_projects()
        self.assertFalse(projects)
        name = "TestProject"
        self.cli_login()
        self.check_cli(["project", "add", name])
        self.check_cli(["project"], stdout=name)

    def test_add_multiple_model(self):
        projects = ["TestProject-%d" % x for x in range(5)]
        for p in projects:
            self.add_project(p)
        r, a, b = self.cli(["project"])
        for p in projects:
            self.assertIn(p, a.splitlines())

    def test_add_multiple_cli(self):
        self.cli_login()
        projects = ["TestProject-%d" % x for x in range(5)]
        for p in projects:
            self.check_cli(["project", "add", p])
        r, a, b = self.cli(["project"])
        for p in projects:
            self.assertIn(p, a.splitlines())

    def test_duplicated(self):
        self.add_project("TestProject")
        self.cli_login()
        r, a, b = self.cli(["project", "add", "TestProject"])
        self.assertNotEqual(r, 0)
        self.assertNotEqual(b, "")

if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.13218997361477572, 'fraction_numerical': 0.004221635883905013, 'mean_word_length': 2.5696798493408664, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2060042', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1185, 'n_words': 279}