Commits

Boris FELD  committed f5c8dc3

Rename test dir to tests.

  • Participants
  • Parent commits 7312cf0

Comments (0)

Files changed (6)

File test/EventDispatcherTest.py

-import sys
-import os.path
-sys.path.append(os.path.realpath('../'))
-
-from EventDispatcher import EventDispatcher
-from Messenger import Messenger
-from lib.undeclaredEventName import undeclaredEventName
-from lib.notCalleableException import notCalleableException
-from lib.eventAlreadyDeclared import eventAlreadyDeclared
-from lib.eventNotDeclared import eventNotDeclared
-
-import unittest
-
-class EventDispatcherTest(unittest.TestCase):
-
-    def setUp(self):
-        self.eventDispatcher = EventDispatcher()
-
-    def tearDown(self):
-        self.eventDispatcher = None
-
-    def testEventDeclaration(self):
-        eventName = 'eventTest'
-        
-        self.eventDispatcher.declare(eventName)
-        self.assertTrue(eventName in self.eventDispatcher.declaredEvents())
-
-    def testFailNoDeclaration(self):
-        def call():
-            pass
-
-        eventName = 'undeclaredEvent'
-        self.assertRaises(undeclaredEventName, lambda: self.eventDispatcher.attach(eventName, call))
-
-    def testFailDoubleDeclaration(self):
-        eventName = 'doubleDeclaration'
-        self.eventDispatcher.declare(eventName)
-        self.assertRaises(eventAlreadyDeclared, lambda: self.eventDispatcher.declare(eventName))
-
-    def testFailNotCalleable(self):
-        eventName = 'notCalleable'
-        self.eventDispatcher.declare(eventName)
-        self.assertRaises(notCalleableException, lambda: self.eventDispatcher.attach(eventName, 'uncalleable'))
-
-    def testFailNotDeclaredEvent(self):
-        eventName = 'notDeclaredEvent'
-        self.assertRaises(eventNotDeclared, lambda: self.eventDispatcher.call(eventName))
-
-    def testEventConnection(self):
-        class SimpleSlot():
-            self.called = False
-            def call(self, argument):
-                self.called = True
-
-        eventName = 'simpleEvent'
-        slot = SimpleSlot()
-        self.eventDispatcher.declare(eventName)
-        self.eventDispatcher.attach(eventName, slot.call)
-        self.eventDispatcher.call(eventName)
-
-        self.assertTrue(slot.called)
-
-    def testSendMessenger(self):
-        class SimpleSlot():
-            def call(self, argument):
-                self.argument = argument
-
-        eventName = 'messengerArgument'
-        slot = SimpleSlot()
-
-        self.eventDispatcher.declare(eventName)
-        self.eventDispatcher.attach(eventName, slot.call)
-        self.eventDispatcher.call(eventName)
-
-        self.assertTrue(isinstance(slot.argument, Messenger))
-
-    def testMessengerStore(self):
-        class StoreSlot():
-            def __init__(self, storeKey, storeValue):
-                self.storeKey = storeKey
-                self.storeValue = storeValue
-            def call(self, argument):
-                argument.store(storeKey, storeValue)
-
-        class SimpleSlot():
-            def call(self, argument):
-                self.argument = argument
-
-        eventName = 'messengerStore'
-        storeKey = 'key'
-        storeValue = 'value'
-
-        storeSlot = StoreSlot(storeKey, storeValue)
-        simpleSlot = SimpleSlot()
-
-        self.eventDispatcher.declare(eventName)
-        self.eventDispatcher.attach(eventName, storeSlot.call)
-        self.eventDispatcher.attach(eventName, simpleSlot.call)
-        self.eventDispatcher.call(eventName)
-
-        self.assertTrue(simpleSlot.argument.contains(storeKey))
-        self.assertEquals(simpleSlot.argument.get(storeKey), storeValue)
-
-unittest.main()

File test/MessengerTest.py

-import sys
-import os.path
-sys.path.append(os.path.realpath('../'))
-
-from Messenger import Messenger
-import unittest
-
-class MessengerTest(unittest.TestCase):
-
-    def setUp(self):
-        self.messenger = Messenger()
-
-    def tearDown(self):
-        self.messenger = None
-
-    def testStore(self):
-        value = 'value'
-        key = 'simple'
-        self.messenger.store(key, value)
-        self.assertEquals(self.messenger.get(key), value)
-
-    def testNoModification(self):
-        value = 'value'
-        value2 = 'value2'
-        key = 'nomodification'
-
-        self.messenger.store(key, value)
-        self.assertRaises(AttributeError, lambda: self.messenger.store(key, value2))
-        self.assertEqual(self.messenger.get(key), value)
-
-unittest.main()

File test/__init__.py

-__author__="lothiraldan"
-__date__ ="$1 juil. 2010 19:52:00$"

File tests/EventDispatcherTest.py

+import sys
+import os.path
+sys.path.append(os.path.realpath('../'))
+
+from EventDispatcher import EventDispatcher
+from Messenger import Messenger
+from lib.undeclaredEventName import undeclaredEventName
+from lib.notCalleableException import notCalleableException
+from lib.eventAlreadyDeclared import eventAlreadyDeclared
+from lib.eventNotDeclared import eventNotDeclared
+
+import unittest
+
+class EventDispatcherTest(unittest.TestCase):
+
+    def setUp(self):
+        self.eventDispatcher = EventDispatcher()
+
+    def tearDown(self):
+        self.eventDispatcher = None
+
+    def testEventDeclaration(self):
+        eventName = 'eventTest'
+        
+        self.eventDispatcher.declare(eventName)
+        self.assertTrue(eventName in self.eventDispatcher.declaredEvents())
+
+    def testFailNoDeclaration(self):
+        def call():
+            pass
+
+        eventName = 'undeclaredEvent'
+        self.assertRaises(undeclaredEventName, lambda: self.eventDispatcher.attach(eventName, call))
+
+    def testFailDoubleDeclaration(self):
+        eventName = 'doubleDeclaration'
+        self.eventDispatcher.declare(eventName)
+        self.assertRaises(eventAlreadyDeclared, lambda: self.eventDispatcher.declare(eventName))
+
+    def testFailNotCalleable(self):
+        eventName = 'notCalleable'
+        self.eventDispatcher.declare(eventName)
+        self.assertRaises(notCalleableException, lambda: self.eventDispatcher.attach(eventName, 'uncalleable'))
+
+    def testFailNotDeclaredEvent(self):
+        eventName = 'notDeclaredEvent'
+        self.assertRaises(eventNotDeclared, lambda: self.eventDispatcher.call(eventName))
+
+    def testEventConnection(self):
+        class SimpleSlot():
+            self.called = False
+            def call(self, argument):
+                self.called = True
+
+        eventName = 'simpleEvent'
+        slot = SimpleSlot()
+        self.eventDispatcher.declare(eventName)
+        self.eventDispatcher.attach(eventName, slot.call)
+        self.eventDispatcher.call(eventName)
+
+        self.assertTrue(slot.called)
+
+    def testSendMessenger(self):
+        class SimpleSlot():
+            def call(self, argument):
+                self.argument = argument
+
+        eventName = 'messengerArgument'
+        slot = SimpleSlot()
+
+        self.eventDispatcher.declare(eventName)
+        self.eventDispatcher.attach(eventName, slot.call)
+        self.eventDispatcher.call(eventName)
+
+        self.assertTrue(isinstance(slot.argument, Messenger))
+
+    def testMessengerStore(self):
+        class StoreSlot():
+            def __init__(self, storeKey, storeValue):
+                self.storeKey = storeKey
+                self.storeValue = storeValue
+            def call(self, argument):
+                argument.store(storeKey, storeValue)
+
+        class SimpleSlot():
+            def call(self, argument):
+                self.argument = argument
+
+        eventName = 'messengerStore'
+        storeKey = 'key'
+        storeValue = 'value'
+
+        storeSlot = StoreSlot(storeKey, storeValue)
+        simpleSlot = SimpleSlot()
+
+        self.eventDispatcher.declare(eventName)
+        self.eventDispatcher.attach(eventName, storeSlot.call)
+        self.eventDispatcher.attach(eventName, simpleSlot.call)
+        self.eventDispatcher.call(eventName)
+
+        self.assertTrue(simpleSlot.argument.contains(storeKey))
+        self.assertEquals(simpleSlot.argument.get(storeKey), storeValue)
+
+unittest.main()

File tests/MessengerTest.py

+import sys
+import os.path
+sys.path.append(os.path.realpath('../'))
+
+from Messenger import Messenger
+import unittest
+
+class MessengerTest(unittest.TestCase):
+
+    def setUp(self):
+        self.messenger = Messenger()
+
+    def tearDown(self):
+        self.messenger = None
+
+    def testStore(self):
+        value = 'value'
+        key = 'simple'
+        self.messenger.store(key, value)
+        self.assertEquals(self.messenger.get(key), value)
+
+    def testNoModification(self):
+        value = 'value'
+        value2 = 'value2'
+        key = 'nomodification'
+
+        self.messenger.store(key, value)
+        self.assertRaises(AttributeError, lambda: self.messenger.store(key, value2))
+        self.assertEqual(self.messenger.get(key), value)
+
+unittest.main()

File tests/__init__.py

+__author__="lothiraldan"
+__date__ ="$1 juil. 2010 19:52:00$"