{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/1575","repository_url":"https://api.github.com/repos/ReactiveX/RxSwift","labels_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/1575/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/1575/comments","events_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/1575/events","html_url":"https://github.com/ReactiveX/RxSwift/pull/1575","id":297073740,"number":1575,"title":"[MaterializedSequenceResult] Add some useful getters for assertions","user":{"login":"ikesyo","id":909674,"avatar_url":"https://avatars0.githubusercontent.com/u/909674?v=4","gravatar_id":"","url":"https://api.github.com/users/ikesyo","html_url":"https://github.com/ikesyo","followers_url":"https://api.github.com/users/ikesyo/followers","following_url":"https://api.github.com/users/ikesyo/following{/other_user}","gists_url":"https://api.github.com/users/ikesyo/gists{/gist_id}","starred_url":"https://api.github.com/users/ikesyo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikesyo/subscriptions","organizations_url":"https://api.github.com/users/ikesyo/orgs","repos_url":"https://api.github.com/users/ikesyo/repos","events_url":"https://api.github.com/users/ikesyo/events{/privacy}","received_events_url":"https://api.github.com/users/ikesyo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-14T12:11:22Z","updated_at":"2018-02-21T08:38:34Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/pulls/1575","html_url":"https://github.com/ReactiveX/RxSwift/pull/1575","diff_url":"https://github.com/ReactiveX/RxSwift/pull/1575.diff","patch_url":"https://github.com/ReactiveX/RxSwift/pull/1575.patch"},"body":"Add four computed properties to `MaterializedSequenceResult`:\r\n\r\n- `isCompleted`\r\n- `isFailed`\r\n- `elements`\r\n- `error`\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/comments/367251146","html_url":"https://github.com/ReactiveX/RxSwift/pull/1575#issuecomment-367251146","issue_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/1575","id":367251146,"user":{"login":"kzaher","id":1641148,"avatar_url":"https://avatars1.githubusercontent.com/u/1641148?v=4","gravatar_id":"","url":"https://api.github.com/users/kzaher","html_url":"https://github.com/kzaher","followers_url":"https://api.github.com/users/kzaher/followers","following_url":"https://api.github.com/users/kzaher/following{/other_user}","gists_url":"https://api.github.com/users/kzaher/gists{/gist_id}","starred_url":"https://api.github.com/users/kzaher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzaher/subscriptions","organizations_url":"https://api.github.com/users/kzaher/orgs","repos_url":"https://api.github.com/users/kzaher/repos","events_url":"https://api.github.com/users/kzaher/events{/privacy}","received_events_url":"https://api.github.com/users/kzaher/received_events","type":"User","site_admin":false},"created_at":"2018-02-21T08:38:34Z","updated_at":"2018-02-21T08:38:34Z","author_association":"MEMBER","body":"Hi @ikesyo ,\r\n\r\nBecause of generality Rx blocking works with any observable sequence, so completable type is erased when using `toBlocking`. Otherwise we would need to create tedious overloads for each type, which wouldn't be much better.\r\n\r\nI understand that this API could be used to test completable, but even then it seems to me that there is no downside of doing `XCTAssertTrue(result.completed, [])`.\r\n\r\nIn case of `XCTAssertTrue(result.isFailed)`, I believe that test could be improved by writing in in the following way: `XCTAssertTrue(result.error, [elements received], expectedError)`. \r\nTesting only for `XCTAssertTrue(result.isFailed)` seems more fragile to me.\r\n\r\nIn case of:\r\n```swift\r\nlet barObservable: Observable<Int> = ...\r\nlet result = barObsrvable.toBlocking().materialize()\r\nXCTAssertEqual(result.elements, [1, 3, 5])\r\n```\r\n\r\nI believe that it is extremely important to test how the sequence terminates. Testing that sequence has produced only a certain sequence of elements and not caring about successful termination or erroring seems fragile to me."}}
{"actor":{"display_login":"kzaher"}}