From 8ed4d508dfdbb537dff7e2ec0293b7b6ac92ce05 Mon Sep 17 00:00:00 2001 From: Tim McNamara Date: Sun, 15 Aug 2010 20:12:39 +0000 Subject: 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. --- 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' -- cgit v0.9.1