<s> try : <EOL> import unittest2 as ut <EOL> except ImportError : <EOL> import unittest as ut <EOL> import sys <EOL> import os <EOL> import platform <EOL> import locale <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> if os . getenv ( '<STR_LIT>' ) == '<STR_LIT>' : <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> else : <EOL> locale . setlocale ( locale . LC_ALL , '<STR_LIT>' ) <EOL> import sip <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> sip . setapi ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> from PyQt4 import QtGui <EOL> from PyQt4 . QtTest import QTest <EOL> from PyQt4 . QtCore import Qt <EOL> from spykeviewer . ui . main_window_neo import MainWindowNeo <EOL> class TestMainWindow ( ut . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> cls . app = QtGui . QApplication ( sys . argv ) <EOL> cls . win = MainWindowNeo ( ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> cls . win . close ( ) <EOL> def test_object_selections ( self ) : <EOL> self . assertNotEqual ( self . win . neo_blocks ( ) , None ) <EOL> self . assertNotEqual ( self . win . neo_segments ( ) , None ) <EOL> self . assertNotEqual ( self . win . neo_channel_groups ( ) , None ) <EOL> self . assertNotEqual ( self . win . neo_channels ( ) , None ) <EOL> self . assertNotEqual ( self . win . neo_units ( ) , None ) <EOL> def test_plugins_loaded ( self ) : <EOL> self . assert_ ( <EOL> self . win . plugin_model . hasIndex ( <NUM_LIT:0> , <NUM_LIT:0> ) , <EOL> '<STR_LIT>' ) <EOL> def test_filter_tree ( self ) : <EOL> self . assertEqual ( <EOL> self . win . filterDock . filterTreeWidget . topLevelItemCount ( ) , <NUM_LIT:5> ) <EOL> def test_file_tree ( self ) : <EOL> self . assert_ ( <EOL> self . win . fileTreeView . model ( ) . hasIndex ( <NUM_LIT:0> , <NUM_LIT:0> ) , <EOL> '<STR_LIT>' ) <EOL> def test_console ( self ) : <EOL> QTest . keyClick ( self . win . console , Qt . Key_1 ) <EOL> QTest . keyClick ( self . win . console , Qt . Key_Plus ) <EOL> QTest . keyClick ( self . win . console , Qt . Key_1 ) <EOL> lines = self . win . console . get_line_count ( ) <EOL> self . assertEqual ( <EOL> self . win . console . get_text_line ( lines - <NUM_LIT:1> ) , '<STR_LIT>' ) <EOL> QTest . keyClick ( self . win . console , Qt . Key_Enter ) <EOL> lines = self . win . console . get_line_count ( ) <EOL> self . assertEqual ( self . win . console . get_text_line ( lines - <NUM_LIT:1> ) , '<STR_LIT>' ) <EOL> def test_history ( self ) : <EOL> history_lines = self . win . history . get_line_count ( ) <EOL> QTest . keyClick ( self . win . console , Qt . Key_5 ) <EOL> QTest . keyClick ( self . win . console , Qt . Key_Enter ) <EOL> self . assertEqual ( <EOL> history_lines + <NUM_LIT:1> , self . win . history . get_line_count ( ) ) <EOL> self . assertEqual ( <EOL> self . win . history . get_text_line ( history_lines ) , '<STR_LIT:5>' ) <EOL> def test_plugin_editor ( self ) : <EOL> self . assertEqual ( <EOL> self . win . pluginEditorDock . tabs . currentWidget ( ) , None ) <EOL> self . win . actionNewPlugin . trigger ( ) <EOL> self . assertNotEqual ( <EOL> self . win . pluginEditorDock . tabs . currentWidget ( ) , None ) <EOL> self . assertEqual ( <EOL> u'<STR_LIT:\n>' . join ( self . win . pluginEditorDock . code ( ) ) , <EOL> unicode ( self . win . pluginEditorDock . template_code + '<STR_LIT:\n>' ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> ut . main ( ) </s>
