From 0cefdf9d879e15399ed76767453d0eb007f05a56 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Thu, 29 Apr 2021 15:23:09 +0000 Subject: [PATCH] [REM] core: remove `test_documentation_examples` module The only purpose of the module `test_documentation_examples` is to test a few of the code examples shown in the developer documentation. As d4ba3117524 removes the documentation sources from the repository, the test module is removed as well. DOC PR: https://github.com/odoo/documentation-user/pull/945 task-2352371 closes odoo/odoo#70256 Signed-off-by: Victor Feyens (vfe) Co-authored-by: Victor Feyens Co-authored-by: Antoine Vandevenne --- .../test_documentation_examples/__init__.py | 6 --- .../__manifest__.py | 16 ------- .../test_documentation_examples/delegation.py | 33 ------------- .../test_documentation_examples/extension.py | 15 ------ .../inheritance.py | 24 ---------- .../ir.model.access.csv | 7 --- .../tests/__init__.py | 4 -- .../tests/test_delegation.py | 47 ------------------- .../tests/test_extension.py | 17 ------- .../tests/test_inheritance.py | 22 --------- 10 files changed, 191 deletions(-) delete mode 100644 odoo/addons/test_documentation_examples/__init__.py delete mode 100644 odoo/addons/test_documentation_examples/__manifest__.py delete mode 100644 odoo/addons/test_documentation_examples/delegation.py delete mode 100644 odoo/addons/test_documentation_examples/extension.py delete mode 100644 odoo/addons/test_documentation_examples/inheritance.py delete mode 100644 odoo/addons/test_documentation_examples/ir.model.access.csv delete mode 100644 odoo/addons/test_documentation_examples/tests/__init__.py delete mode 100644 odoo/addons/test_documentation_examples/tests/test_delegation.py delete mode 100644 odoo/addons/test_documentation_examples/tests/test_extension.py delete mode 100644 odoo/addons/test_documentation_examples/tests/test_inheritance.py diff --git a/odoo/addons/test_documentation_examples/__init__.py b/odoo/addons/test_documentation_examples/__init__.py deleted file mode 100644 index dac6d473aa4..00000000000 --- a/odoo/addons/test_documentation_examples/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import inheritance -from . import extension -from . import delegation diff --git a/odoo/addons/test_documentation_examples/__manifest__.py b/odoo/addons/test_documentation_examples/__manifest__.py deleted file mode 100644 index d4ebde97c91..00000000000 --- a/odoo/addons/test_documentation_examples/__manifest__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. -{ - 'name': "Documentation examples test", - 'description': """ - Contains pieces of code to be used as technical documentation examples - (via the ``literalinclude`` directive) in situations where they can be - syntax-checked and tested. - """, - - 'category': 'Hidden/Tests', - 'version': '0.1', - 'data': [ - 'ir.model.access.csv', - ], -} diff --git a/odoo/addons/test_documentation_examples/delegation.py b/odoo/addons/test_documentation_examples/delegation.py deleted file mode 100644 index a95d4f9f250..00000000000 --- a/odoo/addons/test_documentation_examples/delegation.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models, fields - -class Screen(models.Model): - _name = 'delegation.screen' - _description = 'Screen' - - size = fields.Float(string='Screen Size in inches') - -class Keyboard(models.Model): - _name = 'delegation.keyboard' - _description = 'Keyboard' - - layout = fields.Char(string='Layout') - -class Laptop(models.Model): - _name = 'delegation.laptop' - _description = 'Laptop' - - _inherits = { - 'delegation.screen': 'screen_id', - 'delegation.keyboard': 'keyboard_id', - } - - name = fields.Char(string='Name') - maker = fields.Char(string='Maker') - - # a Laptop has a screen - screen_id = fields.Many2one('delegation.screen', required=True, ondelete="cascade") - # a Laptop has a keyboard - keyboard_id = fields.Many2one('delegation.keyboard', required=True, ondelete="cascade") diff --git a/odoo/addons/test_documentation_examples/extension.py b/odoo/addons/test_documentation_examples/extension.py deleted file mode 100644 index 5e01e800b2f..00000000000 --- a/odoo/addons/test_documentation_examples/extension.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models, fields - -class Extension0(models.Model): - _name = 'extension.0' - _description = 'Extension zero' - - name = fields.Char(default="A") - -class Extension1(models.Model): - _inherit = 'extension.0' - - description = fields.Char(default="Extended") diff --git a/odoo/addons/test_documentation_examples/inheritance.py b/odoo/addons/test_documentation_examples/inheritance.py deleted file mode 100644 index 510adb877d5..00000000000 --- a/odoo/addons/test_documentation_examples/inheritance.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models, fields - -class Inheritance0(models.Model): - _name = 'inheritance.0' - _description = 'Inheritance Zero' - - name = fields.Char() - - def call(self): - return self.check("model 0") - - def check(self, s): - return "This is {} record {}".format(s, self.name) - -class Inheritance1(models.Model): - _name = 'inheritance.1' - _inherit = 'inheritance.0' - _description = 'Inheritance One' - - def call(self): - return self.check("model 1") diff --git a/odoo/addons/test_documentation_examples/ir.model.access.csv b/odoo/addons/test_documentation_examples/ir.model.access.csv deleted file mode 100644 index d576bd70e8f..00000000000 --- a/odoo/addons/test_documentation_examples/ir.model.access.csv +++ /dev/null @@ -1,7 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_inheritance_0,access_inheritance_0,model_inheritance_0,,1,1,1,1 -access_inheritance_1,access_inheritance_1,model_inheritance_1,,1,1,1,1 -access_extension_0,access_extension_0,model_extension_0,,1,1,1,1 -access_delegation_screen,access_delegation_screen,model_delegation_screen,,1,1,1,1 -access_delegation_keyboard,access_delegation_keyboard,model_delegation_keyboard,,1,1,1,1 -access_delegation_laptop,access_delegation_laptop,model_delegation_laptop,,1,1,1,1 diff --git a/odoo/addons/test_documentation_examples/tests/__init__.py b/odoo/addons/test_documentation_examples/tests/__init__.py deleted file mode 100644 index a6ef30e7b07..00000000000 --- a/odoo/addons/test_documentation_examples/tests/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import test_inheritance, test_extension, test_delegation diff --git a/odoo/addons/test_documentation_examples/tests/test_delegation.py b/odoo/addons/test_documentation_examples/tests/test_delegation.py deleted file mode 100644 index 27bf288ceb1..00000000000 --- a/odoo/addons/test_documentation_examples/tests/test_delegation.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo.tests import common - -class TestDelegation(common.TransactionCase): - - def setUp(self): - super(TestDelegation, self).setUp() - env = self.env - record = env['delegation.laptop'].create({ - 'screen_id': env['delegation.screen'].create({'size': 13.0}).id, - 'keyboard_id': env['delegation.keyboard'].create({'layout': 'QWERTY'}).id, - }) - self.record = record - - def test_delegating_record(self): - env = self.env - record = self.record - - # children fields can be looked up on the parent record directly - self.assertEqual( - record.size - , - 13.0 - ) - self.assertEqual( - record.layout - , - 'QWERTY' - ) - - def test_swap_child(self): - env = self.env - record = self.record - - record.write({ - 'screen_id': env['delegation.screen'].create({'size': 17.0}).id - }) - self.assertEqual(record.size, 17.0) - - def test_write(self): - record = self.record - - record.write({'size': 14.0}) - self.assertEqual(record.size, 14.0) - self.assertEqual(record.screen_id.size, 14.0) diff --git a/odoo/addons/test_documentation_examples/tests/test_extension.py b/odoo/addons/test_documentation_examples/tests/test_extension.py deleted file mode 100644 index 957a81b5820..00000000000 --- a/odoo/addons/test_documentation_examples/tests/test_extension.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo.tests import common - -class TestBasicInheritance(common.TransactionCase): - def test_extend_fields(self): - env = self.env - - record = env['extension.0'].create({}) - - reference =\ - {'name': "A", 'description': "Extended"} - values =\ - record.read()[0] - - self.assertLess(reference.items(), values.items()) diff --git a/odoo/addons/test_documentation_examples/tests/test_inheritance.py b/odoo/addons/test_documentation_examples/tests/test_inheritance.py deleted file mode 100644 index 38a1ae5747b..00000000000 --- a/odoo/addons/test_documentation_examples/tests/test_inheritance.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo.tests import common - -class TestBasicInheritance(common.TransactionCase): - def test_inherit_method(self): - env = self.env - - a = env['inheritance.0'].create({'name': 'A'}) - b = env['inheritance.1'].create({'name': 'B'}) - - self.assertEqual( - a.call() - , - "This is model 0 record A" - ) - self.assertEqual( - b.call() - , - "This is model 1 record B" - )