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