Skip to content

Commit

Permalink
Improved Attribute testcases on FileSets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Aug 21, 2023
1 parent 36fff0e commit c61f44d
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions tests/unit/FileSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ def test_FileSet(self):
fileSet.Validate()


class Attr(Attribute):
pass


class Attributes(TestCase):
def test_AddAttribute_WrongType(self):
fileSet = FileSet("fileset")
Expand All @@ -328,7 +332,30 @@ def test_AddAttribute_WrongType(self):
def test_AddAttribute_Normal(self):
fileSet = FileSet("fileset")

class Attr(Attribute):
pass
fileSet[Attr] = 5

def test_GetAttribute_WrongType(self):
fileSet = FileSet("fileset")
fileSet[Attr] = 5

with self.assertRaises(TypeError):
_ = fileSet["attr"]

def test_GetAttribute_Normal(self):
fileSet = FileSet("fileset")
fileSet[Attr] = 5

_ = fileSet[Attr]

def test_DelAttribute_WrongType(self):
fileSet = FileSet("fileset")
fileSet[Attr] = 5

with self.assertRaises(TypeError):
del fileSet["attr"]

def test_DelAttribute_Normal(self):
fileSet = FileSet("fileset")
fileSet[Attr] = 5

del fileSet[Attr]

0 comments on commit c61f44d

Please sign in to comment.