✅ Add basic tests for fast_deepcopy

Should handle regular dict and something that's not
pickleable.
This commit is contained in:
Gina Häußge committed 2021-09-15 18:17:42 +02:00
1 parent 6c81c355b0
commit 4c1d0338f4
1 file changed
+19
+19
View File
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
__copyright__ = "Copyright (C) 2021 The OctoPrint Project - Released under terms of the AGPLv3 License"
import unittest
import octoprint.util
class FastDeepcopyTest(unittest.TestCase):
def test_clean(self):
data = {"a": 1, "b": 2, "c": 3}
self.assertEqual(data, octoprint.util.fast_deepcopy(data))
def test_function(self):
data = {"a": 1, "b": 2, "c": 3, "f": lambda x: x + 1}
self.assertEqual(data, octoprint.util.fast_deepcopy(data))