Files
OctoPrint/tests/util/test_fast_deepcopy.py
T
Gina Häußge 4c1d0338f4 ✅ Add basic tests for fast_deepcopy
Should handle regular dict and something that's not
pickleable.
2021-09-15 18:17:42 +02:00

20 lines
677 B
Python

# -*- 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))