[blivet:master 2/6] Don't make overridden values actual properties.

mulhern amulhern at redhat.com
Fri Dec 5 16:08:32 UTC 2014


When extending an abstract class which defines an abstract property it
is not necessary to make the overriding values properties, it's fine
just to make them regular class attributes. The abstract class checking
mechanism accepts these, and will have an error if they are not defined
at all.

The imaginary requirement to make them properties is something that seems
to follow naturally if you're thinking of a statically checked language.

It didn't cause any harm to make these fields properties, it was just
annoyingly verbose.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 tests/formats_test/labeling_test.py | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/tests/formats_test/labeling_test.py b/tests/formats_test/labeling_test.py
index e4b237d..8ac2e9b 100755
--- a/tests/formats_test/labeling_test.py
+++ b/tests/formats_test/labeling_test.py
@@ -91,32 +91,32 @@ class MethodsTestCase(unittest.TestCase):
                 self.assertEqual(klass(device="/dev", label=label).label, label, msg=name)
 
 class XFSTestCase(fslabeling.CompleteLabelingAsRoot):
-    _fs_class = property(lambda s: fs.XFS)
-    _invalid_label = property(lambda s: "root filesystem")
+    _fs_class = fs.XFS
+    _invalid_label = "root filesystem"
 
 class FATFSTestCase(fslabeling.CompleteLabelingAsRoot):
-    _fs_class = property(lambda s: fs.FATFS)
-    _invalid_label = property(lambda s: "root___filesystem")
+    _fs_class = fs.FATFS
+    _invalid_label = "root___filesystem"
 
 class Ext2FSTestCase(fslabeling.CompleteLabelingAsRoot):
-    _fs_class = property(lambda s: fs.Ext2FS)
-    _invalid_label = property(lambda s: "root___filesystem")
+    _fs_class = fs.Ext2FS
+    _invalid_label = "root___filesystem"
 
 class JFSTestCase(fslabeling.LabelingWithRelabeling):
-    _fs_class = property(lambda s: fs.JFS)
-    _invalid_label = property(lambda s: "root___filesystem")
+    _fs_class = fs.JFS
+    _invalid_label = "root___filesystem"
 
 class ReiserFSTestCase(fslabeling.LabelingWithRelabeling):
-    _fs_class = property(lambda s: fs.ReiserFS)
-    _invalid_label = property(lambda s: "root___filesystem")
+    _fs_class = fs.ReiserFS
+    _invalid_label = "root___filesystem"
 
 class HFSTestCase(fslabeling.LabelingAsRoot):
-    _fs_class = property(lambda s: fs.HFS)
-    _invalid_label = property(lambda s: "n" * 28)
+    _fs_class = fs.HFS
+    _invalid_label = "n" * 28
 
 class HFSPlusTestCase(fslabeling.LabelingAsRoot):
-    _fs_class = property(lambda s: fs.HFSPlus)
-    _invalid_label = property(lambda s: "n" * 129)
+    _fs_class = fs.HFSPlus
+    _invalid_label = "n" * 129
 
 class LabelingSwapSpaceTestCase(loopbackedtestcase.LoopBackedTestCase):
 
-- 
1.9.3



More information about the anaconda-patches mailing list