[PATCH 3 of 3 seda] [test] Add a little test for concept_value function

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Aug 24 16:24:31 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1503584644 -7200
#      Thu Aug 24 16:24:04 2017 +0200
# Node ID 274dcd2aafbfcb7a6cd864e039e6cf4b4918fb17
# Parent  3572864fe580c941ec9bc960e2fd058069c41074
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r 274dcd2aafbf
[test] Add a little test for concept_value function

Ensure language priority.

diff --git a/test/test_profile_generation.py b/test/test_profile_generation.py
--- a/test/test_profile_generation.py
+++ b/test/test_profile_generation.py
@@ -922,8 +922,23 @@ class SEDAExportUnitTest(unittest.TestCa
 
     def test_concepts_languages(self):
         self.assertEqual(pg.SEDA1XSDExport.concepts_language, 'seda-1')
         self.assertEqual(pg.SEDA02XSDExport.concepts_language, 'seda-02')
 
+    def test_concept_value(self):
+        class concept:
+            labels = {}
+
+        concept.labels['fr'] = 'Bonjour'
+        self.assertEqual(pg._concept_value(concept, 'seda-1'), 'Bonjour')
+        concept.labels['en'] = 'Hello'
+        self.assertEqual(pg._concept_value(concept, 'seda-1'), 'Hello')
+        concept.labels['seda'] = 'hello'
+        self.assertEqual(pg._concept_value(concept, 'seda-1'), 'hello')
+        concept.labels['seda-1'] = 'hello you'
+        self.assertEqual(pg._concept_value(concept, 'seda-1'), 'hello you')
+        concept.labels['seda-2'] = 'good-by'
+        self.assertEqual(pg._concept_value(concept, 'seda-1'), 'hello you')
+
 
 if __name__ == '__main__':
     unittest.main()


More information about the saem-devel mailing list