Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim McNamara <code@timmcnamara.co.nz>2010-08-15 20:12:39 (GMT)
committer Tim McNamara <code@timmcnamara.co.nz>2010-08-15 20:12:39 (GMT)
commit8ed4d508dfdbb537dff7e2ec0293b7b6ac92ce05 (patch)
tree06672535463323d924100d682e3e54105507360b
parent2214629718617049fb1a503d9e5ba9ccf4adf2b4 (diff)
Added tests to simplify widget identification
Am beginning to refactor widget identification code to make it more Pythonic. Will be adding tests as I move through the code.
-rw-r--r--Experior.Activity/tests/test_widgetIdentifier_identification.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Experior.Activity/tests/test_widgetIdentifier_identification.py b/Experior.Activity/tests/test_widgetIdentifier_identification.py
new file mode 100644
index 0000000..d00f4c1
--- /dev/null
+++ b/Experior.Activity/tests/test_widgetIdentifier_identification.py
@@ -0,0 +1,30 @@
+#! /usr/env/bin python
+
+# test_widgetIdentifier_validation tests that the validators work correctly.
+# designed to be used with py.test
+import gtk
+
+from sys import path
+path.append('..')
+
+from widgetIdentifier import *
+
+L = gtk.Label('Test subject')
+
+def test_label_matches():
+ W = WidgetIdentifier(L)
+ assert W.getIdentifier() == 'Test subject'
+
+L2 = gtk.Label('Test subject')
+L2.set_name('1')
+def test_set_name_matches():
+ W = WidgetIdentifier(L2)
+ assert W.getIdentifier() == '1'
+
+
+B = ButtonIdentifier(gtk.Button('Stop'))
+def test_button_id():
+ assert B.getIdentifier() == 'Stop'
+
+def test_button_id_sub():
+ assert B.getIdentifierSub() == 'Stop'