Adrià Vilanova MartÃnez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | # Copyright 2018 The Chromium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | """Unit test for generate_features.""" |
| 6 | from __future__ import print_function |
| 7 | from __future__ import division |
| 8 | from __future__ import absolute_import |
| 9 | |
| 10 | import unittest |
| 11 | |
| 12 | from features import generate_dataset |
| 13 | |
| 14 | |
| 15 | class GenerateFeaturesTest(unittest.TestCase): |
| 16 | |
| 17 | def testCleanText(self): |
| 18 | sampleText = """Here's some sample text...$*IT should l00k much\n\n\t, |
| 19 | _much_MUCH better \"cleaned\"!""" |
| 20 | self.assertEqual(generate_dataset.CleanText(sampleText), |
| 21 | ("heres some sample text it should l00k much much much " |
| 22 | "better cleaned")) |
| 23 | emptyText = "" |
| 24 | self.assertEqual(generate_dataset.CleanText(emptyText), "") |