-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD writer_tests.py: unit tests for writer.py
Currently 11 tests are present.
- Loading branch information
1 parent
4de5078
commit 72a63ff
Showing
21 changed files
with
932 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,24 @@ | ||
from uuid import UUID | ||
|
||
class Identifiable: | ||
|
||
def __init__(self, uId = None): | ||
self.id = uId | ||
self._id = uId | ||
if not id: | ||
self.id = id(self) | ||
self._id = id(self) | ||
|
||
@property | ||
def id(self): | ||
return self._id | ||
|
||
@id.setter | ||
def id(self, newVal): | ||
if isinstance(newVal, UUID): | ||
self._id = newVal | ||
elif isinstance(newVal, str): | ||
try: | ||
self._id = UUID(newVal) | ||
except: | ||
self._id = newVal | ||
else: | ||
raise ValueError("Id has to be of type UUID or string!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.