コード例 #1
0
def test_session_from_json(tmpdir_factory, session_data, get_expected, get_from_session):
    session = BehaviorOphysSession(api=BehaviorOphysJsonApi(session_data))

    expected = get_expected(session_data)
    obtained = get_from_session(session)

    compare_session_fields(expected, obtained)
コード例 #2
0
ファイル: behavior_metadata.py プロジェクト: rgerkin/AllenSDK
    def __eq__(self, other):
        if not isinstance(other, (BehaviorMetadata, dict)):
            msg = f'Do not know how to compare with type {type(other)}'
            raise NotImplementedError(msg)

        properties_self = self.to_dict()

        if isinstance(other, dict):
            properties_other = other
        else:
            properties_other = other.to_dict()

        for p in properties_self:
            if p in self._exclude_from_equals:
                continue

            x1 = properties_self[p]
            x2 = properties_other[p]

            try:
                compare_session_fields(x1=x1, x2=x2)
            except AssertionError:
                return False
        return True