コード例 #1
0
    def test_get_name(self):
        ws = MockWorkspace()
        expected_name = "TEST_WORKSPACE"
        ws.name = Mock(return_value=expected_name)
        model = MatrixWorkspaceDisplayModel(ws)

        self.assertEqual(expected_name, model.get_name())
コード例 #2
0
    def test_get_name(self):
        ws = MockWorkspace()
        expected_name = "TEST_WORKSPACE"
        ws.name = Mock(return_value=expected_name)
        model = MatrixWorkspaceDisplayModel(ws)

        self.assertEqual(expected_name, model.get_name())
コード例 #3
0
    def test_no_raise_with_supported_workspace(self):
        ws = MockWorkspace()
        expected_name = "TEST_WORKSPACE"
        ws.name = Mock(return_value=expected_name)

        # no need to assert anything - if the constructor raises the test will fail
        MatrixWorkspaceDisplayModel(ws)

        ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=4, NumEvents=10)
        MatrixWorkspaceDisplayModel(ws)
コード例 #4
0
    def test_get_item_model(self):
        ws = MockWorkspace()
        expected_name = "TEST_WORKSPACE"
        ws.name = Mock(return_value=expected_name)
        model = MatrixWorkspaceDisplayModel(ws)

        x_model, y_model, e_model = model.get_item_model()

        self.assertEqual(x_model.type, MatrixWorkspaceTableViewModelType.x)
        self.assertEqual(y_model.type, MatrixWorkspaceTableViewModelType.y)
        self.assertEqual(e_model.type, MatrixWorkspaceTableViewModelType.e)
コード例 #5
0
    def test_get_item_model(self):
        ws = MockWorkspace()
        expected_name = "TEST_WORKSPACE"
        ws.name = Mock(return_value=expected_name)
        model = MatrixWorkspaceDisplayModel(ws)

        x_model, y_model, e_model = model.get_item_model()

        self.assertEqual(x_model.type, MatrixWorkspaceTableViewModelType.x)
        self.assertEqual(y_model.type, MatrixWorkspaceTableViewModelType.y)
        self.assertEqual(e_model.type, MatrixWorkspaceTableViewModelType.e)
コード例 #6
0
 def test_raises_with_unsupported_workspace(self):
     self.assertRaises(ValueError, lambda: MatrixWorkspaceDisplayModel([]))
     self.assertRaises(ValueError, lambda: MatrixWorkspaceDisplayModel(1))
     self.assertRaises(ValueError,
                       lambda: MatrixWorkspaceDisplayModel("test_string"))