コード例 #1
0
 def setUp(self):
     with \
             Autowired('DataTestData', self),\
             Autowired('AiTestData', self),\
             Autowired('UpdateTestData', self),\
             MockedService('PrepareDataService', self),\
             MockedService('NeuralNetBuilderService', self),\
             MockedService('NeuralNetTrainerService', self),\
             MockedService('AccuracyCheckService', self),\
             MockedService('UpdateService', self):
         categorizerService.call()
コード例 #2
0
    def setUp(self):

        with \
          Autowired('UpdateTestData', self),\
          Autowired('DbTestData', self),\
          MockedService('RowUpdateService', self),\
          MockedService('ConnectionService', self),\
          MockedService('CategoryService', self):

            updateService.call(self.UpdateTestData.data)

            self.handleOneRowArgs = self.RowUpdateService.call
コード例 #3
0
    def runTest(self, choice):
        with \
          MockedService('UpdateDBService', self),\
          MockedService('RowProviderService', self),\
          MockedService('TransactionDisplayService', self),\
          MockedService('OptionPreparatorService', self),\
          MockedService('ChoiceObtainerService', self):

            self.ChoiceObtainerStubs.answerIs(choice)

            rowUpdateService.call(self.UpdateTestData.rowNumber,
                                  self.UpdateTestData.data,
                                  self.DbTestData.connection,
                                  self.UpdateTestData.categories)
コード例 #4
0
 def setUp(self):
     with\
             Autowired('DataTestData',self),\
             MockedService('NumericConverterService', self):
         self.result = prepareDataService.call(
             self.DataTestData.TRAIN_SET, self.DataTestData.PROBLEM_SET)
     self.callList = self.NumericConverterService.call.mock_calls
コード例 #5
0
 def testdisplayTransaction_prints_the_transaction(self):
     with\
             Autowired('DbTestData', self),\
             MockedService('sys.stdout') as mockedStdout:
         transactionDisplayService.call(self.DbTestData.fetched_row)
     TestHelper.assertPrintedOn(mockedStdout, self.DbTestData.fetched_row)
コード例 #6
0
 def test_MockedService_does_not_leave_foreign_service_in_registry(self):
     with MockedService('sys.stderr', self):
         sys.stderr.write("hello")
     self.assertFalse('sys.stderr' in providers)
コード例 #7
0
 def test_MockedService_unmocks_foreign_stuff_after_use(self):
     with MockedService('sys.stderr', self):
         sys.stderr.write("hello")
     sys.stderr.write("hello")
     self.sys_stderr.write.assert_called_once()
コード例 #8
0
ファイル: StubTest.py プロジェクト: kode-konveyor/winterboot
 def test_MockedService_runs_the_behaviour_only_if_stubs_exist_for_the_service(
         self):
     with MockedService('ExampleNonstubbedService', self):
         pass
コード例 #9
0
 def setUp(self):
     with\
             Autowired('DataTestData', self),\
             MockedService('keras.Sequential') as self.model:
         self.result = neuralNetBuilderService().call(self.DataTestData.MAX_LENGTH, self.DataTestData.OUTPUT_NEURONS )
     self.firstCallList = TestHelper.callArgument(self.model, 0)
コード例 #10
0
 def test_MockedService_changes_the_original_service(self):
     with MockedService('TheExampleService') as TheExampleService:
         TheExampleServiceCreatedBeforeMock().foo()
         TheExampleService.foo.assert_called_once()
コード例 #11
0
 def runTestWithAccuracy(self, accuracy):
     with\
         MockedService('DisplayAccuracyService', self),\
         MockedService('AccuracyErrorDisplayService', self),\
         unittest.mock.patch('sys.exit') as self.sysExit:
         accuracyCheckService.call(accuracy)
コード例 #12
0
 def it_displays_the_transaction(self):
     with\
             Autowired('UiTestData', self),\
             MockedService('sys.stdout') as mockedStdout:
         accuracyErrorDisplayService.displayAccurracyError()
     TestHelper.assertPrintedOn(mockedStdout, self.UiTestData.ACCURACY_ERROR_MESSAGE)
コード例 #13
0
 def setUp(self):
     with MockedService('WinterBootTestData', self):
         self.serviceId = self.WinterBootTestData.undefinedConsumedServiceId
     self.testArtifact = Autowired(self.serviceId)
     self.TheExampleServiceClassName = 'TheExampleService'
コード例 #14
0
    def runTest(self, choice):
        with MockedService('ChoiceAskService', self):
            self.ChoiceAskStubs.answerIs(choice)

            choice = choiceObtainerService.call(self.options)
        return choice
コード例 #15
0
ファイル: StubTest.py プロジェクト: kode-konveyor/winterboot
 def test_MockedService_can_patch_foreign_service(self):
     with MockedService('sys.stdin', self):
         self.assertEqual("foo", sys.stdin.readline())
コード例 #16
0
 def setUp(self):
     with\
         Autowired('UpdateTestData', self, singleton=False),\
         MockedService('OptionDisplayService', self):
         self.result = optionPreparatorService.call(
             self.UpdateTestData.rowNumber, self.UpdateTestData.data, self.UpdateTestData.categories)
コード例 #17
0
 def setUp(self):
     with\
             Autowired('UiTestData', self),\
             MockedService('categorizerai.ui.ChoiceAskService.input') as self.mockedInput:
         self.answer = choiceAskService.call()
コード例 #18
0
 def test_MockedService_adds_field_to_instance_if_asked(self):
     with MockedService('TheExampleService', self):
         TheExampleServiceCreatedBeforeMock().bar()
         self.TheExampleService.bar.assert_called_once()
コード例 #19
0
 def test_MockedService_can_mock_foreign_stuff(self):
     with MockedService('sys.stderr', self):
         sys.stderr.write("hello")
     self.sys_stderr.write.assert_called_once()
コード例 #20
0
ファイル: StubTest.py プロジェクト: kode-konveyor/winterboot
 def test_MockedService_runs_the_behaviour_of_the_stub_of_the_related_service(
         self):
     with MockedService('TheExampleService', self):
         self.assertEqual('get:foo', self.TheExampleService.method('foo'))