diff options
author | John Estabrook <jestabro@vyos.io> | 2025-02-05 16:31:38 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2025-03-16 23:55:12 -0500 |
commit | 4dc02b404311aa39b2f5374103c106367d2cc14e (patch) | |
tree | cbef5aadb41c7ad34a92d50378182db001f03b51 /src/tests | |
parent | defc2b665940a8fa14dcc1753dc40bdee0f52a64 (diff) | |
download | vyos-1x-4dc02b404311aa39b2f5374103c106367d2cc14e.tar.gz vyos-1x-4dc02b404311aa39b2f5374103c106367d2cc14e.zip |
T7121: use dunder equal instead of string rep comparison, where possible
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_config_diff.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tests/test_config_diff.py b/src/tests/test_config_diff.py index 39e17613a..4017fff4d 100644 --- a/src/tests/test_config_diff.py +++ b/src/tests/test_config_diff.py @@ -31,11 +31,11 @@ class TestConfigDiff(TestCase): def test_unit(self): diff = vyos.configtree.DiffTree(self.config_left, self.config_null) sub = diff.sub - self.assertEqual(sub.to_string(), self.config_left.to_string()) + self.assertEqual(sub, self.config_left) diff = vyos.configtree.DiffTree(self.config_null, self.config_left) add = diff.add - self.assertEqual(add.to_string(), self.config_left.to_string()) + self.assertEqual(add, self.config_left) def test_symmetry(self): lr_diff = vyos.configtree.DiffTree(self.config_left, @@ -45,10 +45,10 @@ class TestConfigDiff(TestCase): sub = lr_diff.sub add = rl_diff.add - self.assertEqual(sub.to_string(), add.to_string()) + self.assertEqual(sub, add) add = lr_diff.add sub = rl_diff.sub - self.assertEqual(add.to_string(), sub.to_string()) + self.assertEqual(add, sub) def test_identity(self): lr_diff = vyos.configtree.DiffTree(self.config_left, @@ -61,6 +61,9 @@ class TestConfigDiff(TestCase): r_union = vyos.configtree.union(add, inter) l_union = vyos.configtree.union(sub, inter) + # here we must compare string representations instead of using + # dunder equal, as we assert equivalence of the values list, which + # is optionally ordered at render self.assertEqual(r_union.to_string(), self.config_right.to_string(ordered_values=True)) self.assertEqual(l_union.to_string(), |