コード例 #1
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_equality(self):
     """
     A L{NamedConstant} instance compares equal to itself.
     """
     name = NamedConstant()
     name._realize(self.container, "bar", None)
     self.assertTrue(name == name)
     self.assertFalse(name != name)
コード例 #2
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_name(self):
     """
     The C{name} attribute of a L{NamedConstant} refers to the value passed
     for the C{name} parameter to C{_realize}.
     """
     name = NamedConstant()
     name._realize(self.container, "bar", None)
     self.assertEqual("bar", name.name)
コード例 #3
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_representation(self):
     """
     The string representation of an instance of L{NamedConstant} includes
     the container the instances belongs to as well as the instance's name.
     """
     name = NamedConstant()
     name._realize(self.container, "bar", None)
     self.assertEqual("<foo=bar>", repr(name))
コード例 #4
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_equality(self):
     """
     A L{NamedConstant} instance compares equal to itself.
     """
     name = NamedConstant()
     name._realize(self.container, "bar", None)
     self.assertTrue(name == name)
     self.assertFalse(name != name)
コード例 #5
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_representation(self):
     """
     The string representation of an instance of L{NamedConstant} includes
     the container the instances belongs to as well as the instance's name.
     """
     name = NamedConstant()
     name._realize(self.container, "bar", None)
     self.assertEqual("<foo=bar>", repr(name))
コード例 #6
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_name(self):
     """
     The C{name} attribute of a L{NamedConstant} refers to the value passed
     for the C{name} parameter to C{_realize}.
     """
     name = NamedConstant()
     name._realize(self.container, "bar", None)
     self.assertEqual("bar", name.name)
コード例 #7
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_hash(self):
     """
     Because two different L{NamedConstant} instances do not compare as equal
     to each other, they also have different hashes to avoid collisions when
     added to a C{dict} or C{set}.
     """
     first = NamedConstant()
     first._realize(self.container, "bar", None)
     second = NamedConstant()
     second._realize(self.container, "bar", None)
     self.assertNotEqual(hash(first), hash(second))
コード例 #8
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_nonequality(self):
     """
     Two different L{NamedConstant} instances do not compare equal to each
     other.
     """
     first = NamedConstant()
     first._realize(self.container, "bar", None)
     second = NamedConstant()
     second._realize(self.container, "bar", None)
     self.assertFalse(first == second)
     self.assertTrue(first != second)
コード例 #9
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_hash(self):
     """
     Because two different L{NamedConstant} instances do not compare as equal
     to each other, they also have different hashes to avoid collisions when
     added to a C{dict} or C{set}.
     """
     first = NamedConstant()
     first._realize(self.container, "bar", None)
     second = NamedConstant()
     second._realize(self.container, "bar", None)
     self.assertNotEqual(hash(first), hash(second))
コード例 #10
0
ファイル: test_compat.py プロジェクト: Gandi/wokkel
 def test_nonequality(self):
     """
     Two different L{NamedConstant} instances do not compare equal to each
     other.
     """
     first = NamedConstant()
     first._realize(self.container, "bar", None)
     second = NamedConstant()
     second._realize(self.container, "bar", None)
     self.assertFalse(first == second)
     self.assertTrue(first != second)