コード例 #1
0
ファイル: scanner_test.py プロジェクト: rca/autonose
	def test_should_load_saved_dependency_information(self):
		picklefile = mock('pickle file')
		mock_on(builtin).open.is_expected.\
			with_(pickle_path).\
			returning(picklefile.raw)
		pickle = mock('unpickled info')
		mock_on(scanner.pickle).load.is_expected.with_(picklefile.raw).returning(pickle.raw)
		
		loaded = scanner.load()
		self.assertEqual(loaded, pickle.raw)
コード例 #2
0
ファイル: scanner_test.py プロジェクト: lieryan/autonose
	def test_should_load_saved_dependency_information(self):
		picklefile = mock('pickle file')
		expect(scanner).open_file(pickle_path).and_return(picklefile)
		pickle = mock('unpickled info')
		expect(scanner.pickle).load(picklefile).and_return(pickle)

		manager = mock('manager')
		expect(scanner.FileSystemStateManager)['__new__'](any_(type), pickle).and_return(manager)
		
		loaded = scanner.load()
		self.assertEqual(loaded, manager)
コード例 #3
0
    def test_should_load_saved_dependency_information(self):
        picklefile = mock('pickle file')
        mock_on(scanner).open_file.is_expected.\
         with_(pickle_path).\
         returning(picklefile.raw)
        pickle = mock('unpickled info')
        mock_on(scanner.pickle).load.is_expected.with_(
            picklefile.raw).returning(pickle.raw)

        loaded = scanner.load()
        self.assertEqual(loaded, pickle.raw)
コード例 #4
0
ファイル: scanner_test.py プロジェクト: lieryan/autonose
	def test_should_return_an_empty_dict_when_no_pickle_exists(self):
		expect(scanner).open_file.and_raise(IOError())
		state = mock('state')
		manager = mock('manager')
		expect(scanner.FileSystemState)['__new__'].and_return(state)
		expect(scanner.FileSystemStateManager)['__new__'].and_return(manager)
		expect(scanner.pickle).load.never()
		expect(manager).update
		modify(sys).stderr = mock('stderr')
		expect(sys.stderr).write.never()
		
		self.assertEqual(scanner.load(), manager)
コード例 #5
0
ファイル: scanner_test.py プロジェクト: rca/autonose
	def test_should_return_an_empty_dict_when_no_pickle_exists(self):
		mock_on(builtin).open.is_expected.raising(IOError())
		mock_on(scanner.pickle).load.is_not_expected
		mock_on(sys).stderr.is_not_expected
		
		self.assertEqual(scanner.load(), {})
コード例 #6
0
    def test_should_return_an_empty_dict_when_no_pickle_exists(self):
        mock_on(scanner).open_file.is_expected.raising(IOError())
        mock_on(scanner.pickle).load.is_not_expected
        mock_on(sys).stderr.is_not_expected

        self.assertEqual(scanner.load(), {})