1. Jonathan Eunice
  2. options

Commits

Jonathan Eunice  committed a1f65aa

Improved Options.copy()

  • Participants
  • Parent commits 56fc4ce
  • Branches default

Comments (0)

Files changed (2)

File options/core.py

View file
  • Ignore whitespace
         for k in c.config:
             self[k] = c.config[k]
             
+    def copy(self):
+        """
+        Return a copy of this instance.
+        """
+        new = orderedstuf.copy(self)
+        new._magic = self._magic.copy()
+        return new
+            
         # UNDER CONSTRUCTION
             
         # use read, sections, itesms as in this note

File test/test.py

View file
  • Ignore whitespace
     o1 = options.copy()
     assert o1 is not options
     assert o1 == options
+    
     o2 = options.push(dict(this=4, blik='rubber'))
     assert o2.nick == 'nack'
     assert o2.slick == 'slack'