Exemplo n.º 1
0
def show_block(problem):
    return {
        'status_description':
        TodoGenerator.get_status_description(problem.path),
        'tests_count': TodoGenerator.generated_tests_count(problem.path),
        'samples_present': TodoGenerator.sample_tests_count(problem.path) > 0,
    }
Exemplo n.º 2
0
    def test_empty_solution(self):
        ITEMS = (
            "statement",
            "checker",
            "description",
            "analysis",
            "validator",
            "main_solution",
            "tags",
            "name",
            "tests_description",
        )
        TRANSITION = dict(map(lambda item: (item, "warning"), ITEMS))

        TodoGenerator._TodoGenerator__get_file_item_status = lambda config, md5_values, item, path=None, root_path=None: TRANSITION[
            item
        ]
        TodoGenerator._TodoGenerator__get_simple_item_status = lambda config, item: TRANSITION[item]

        self.assertDictEqual(
            dict(TodoGenerator.get_status_description()),
            {
                "statement": "default",
                "checker": "default",
                "description": "default",
                "analysis": "default",
                "validator": "default",
                "main_solution": "default",
                "tags": "empty",
                "name": "empty",
                "tests description": "default",
            },
        )
Exemplo n.º 3
0
    def test_empty_solution(self):
        ITEMS = ('statement', 'checker', 'description', 'analysis',
                 'validator', 'main_solution', 'tags', 'name',
                 'tests_description')
        TRANSITION = dict(map(lambda item: (item, 'warning'), ITEMS))

        TodoGenerator._TodoGenerator__get_file_item_status = lambda config, md5_values, item, path=None, root_path=None: TRANSITION[
            item]
        TodoGenerator._TodoGenerator__get_simple_item_status = lambda config, item: TRANSITION[
            item]

        self.assertDictEqual(
            dict(TodoGenerator.get_status_description()), {
                'statement': 'default',
                'checker': 'default',
                'description': 'default',
                'analysis': 'default',
                'validator': 'default',
                'main_solution': 'default',
                'tags': 'empty',
                'name': 'empty',
                'tests description': 'default',
            })
Exemplo n.º 4
0
def show_block(problem):
    return {
        'status_description': TodoGenerator.get_status_description(problem.path),
        'tests_count': TodoGenerator.generated_tests_count(problem.path),
        'samples_present': TodoGenerator.sample_tests_count(problem.path) > 0,
    }
Exemplo n.º 5
0
 def test_generated_tests_count(self):
     with patch("please.utils.utests.get_tests", return_value=[1, 2, 3]):
         self.assertEqual(TodoGenerator.generated_tests_count(), 3)
Exemplo n.º 6
0
 def test_generated_tests_count(self):
     with patch('please.utils.utests.get_tests', return_value=[1, 2, 3]):
         self.assertEqual(TodoGenerator.generated_tests_count(), 3)