From 262c23170a91f1211c11315f369f040aef511699 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Tue, 16 Jan 2024 10:03:23 +0000 Subject: [PATCH] Unit tests for negation function --- tests/test_negator.py | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/test_negator.py diff --git a/tests/test_negator.py b/tests/test_negator.py new file mode 100644 index 0000000..0740984 --- /dev/null +++ b/tests/test_negator.py @@ -0,0 +1,45 @@ +''' +MIT License + +Copyright (c) 2023 Ulster University (https://www.ulster.ac.uk). +Project: Harmony (https://harmonydata.ac.uk) +Maintainer: Thomas Wood (https://fastdatascience.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +''' + +import unittest + +from harmony.matching.negator import negate + + +class TestNegation(unittest.TestCase): + + def test_simple_example(self): + text = "I never feel depressed" + self.assertEqual("I feel depressed", negate(text, "en")) + + def test_simple_example_pt(self): + text = "eu me sinto deprimido" + self.assertEqual("não eu me sinto deprimido", negate(text, "pt")) + + +if __name__ == '__main__': + unittest.main()