def test_smoke(self):
        """Does a complete run with mock data"""
        business = BUSINESS_TEMPLATE % (CATEGORY, BIZ_ID)
        review = REVIEW_TEMPLATE % (LONG_TEXT, BIZ_ID)
        total_input = business + review
        static_stdin = StringIO(total_input)

        job = CategoryPredictor(['-r', 'inline', '--no-conf', '-'])
        job.sandbox(stdin=static_stdin)

        results = []
        with job.make_runner() as runner:
            runner.run()
            for line in runner.stream_output():
                key, value = job.parse_output_line(line)
                results.append(value)

        # Results should be the probability of that category being chosen.
        result = {CATEGORY: 1}
        self.assertEqual(results[0], result)
예제 #2
0
    def test_smoke(self):
        """Does a complete run with mock data"""
        business = BUSINESS_TEMPLATE % (CATEGORY, BIZ_ID)
        review = REVIEW_TEMPLATE % (LONG_TEXT, BIZ_ID)
        total_input = business + review
        static_stdin = StringIO(total_input)

        job = CategoryPredictor(['-r', 'inline', '--no-conf', '-'])
        job.sandbox(stdin=static_stdin)

        results = []
        with job.make_runner() as runner:
            runner.run()
            for line in runner.stream_output():
                key, value = job.parse_output_line(line)
                results.append(value)

        # Results should be the probability of that category being chosen.
        result = {CATEGORY: 1}
        self.assertEqual(results[0], result)