GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Comparison fails for unit tests with timestamps · Issue #897 · googleapis/gapic-generator-python

This repository was archived by the owner on Aug 25, 2026. It is now read-only.
This repository was archived by the owner on Aug 25, 2026. It is now read-only.

Comparison fails for unit tests with timestamps #897

Copy link
Copy link
Closed
#898
Closed
Comparison fails for unit tests with timestamps#897
#898
Copy link
Assignees
busunkim96
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@busunkim96
busunkim96
opened on May 19, 2021
Issue body actions

This looks like #508, probably appearing again as the current logic checks for a string match of the field.ident and that changed in #851.

________________________________________________ test_set_finding_state_flattened_async _________________________________________________

    @pytest.mark.asyncio
    async def test_set_finding_state_flattened_async():
        client = SecurityCenterAsyncClient(
            credentials=ga_credentials.AnonymousCredentials(),
        )
    
        # Mock the actual call within the gRPC stub, and fake the request.
        with mock.patch.object(
            type(client.transport.set_finding_state), "__call__"
        ) as call:
            # Designate an appropriate return value for the call.
            call.return_value = finding.Finding()
    
            call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(finding.Finding())
            # Call the method with a truthy value for each flattened field,
            # using the keyword arguments to the method.
            response = await client.set_finding_state(
                name="name_value",
                state=finding.Finding.State.ACTIVE,
                start_time=timestamp_pb2.Timestamp(seconds=751),
            )
    
            # Establish that the underlying call was made with the expected
            # request object values.
            assert len(call.mock_calls)
            _, args, _ = call.mock_calls[0]
            assert args[0].name == "name_value"
            assert args[0].state == finding.Finding.State.ACTIVE
>           assert args[0].start_time == timestamp_pb2.Timestamp(seconds=751)
E           assert DatetimeWithNanoseconds(1970, 1, 1, 0, 12, 31, tzinfo=datetime.timezone.utc) == seconds: 751\n
E            +  where DatetimeWithNanoseconds(1970, 1, 1, 0, 12, 31, tzinfo=datetime.timezone.utc) = name: "name_value"\nstate: ACTIVE\nstart_time {\n  seconds: 751\n}\n.start_time
E            +  and   seconds: 751\n = <class 'google.protobuf.timestamp_pb2.Timestamp'>(seconds=751)
E            +    where <class 'google.protobuf.timestamp_pb2.Timestamp'> = timestamp_pb2.Timestamp

tests/unit/gapic/securitycenter_v1beta1/test_security_center.py:3670: AssertionError

Activity

  1. busunkim96
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on May 19, 2021
  2. busunkim96
    self-assigned this
    on May 19, 2021
  3. gcf-merge-on-green
    closed this as completedin #898on May 20, 2021
  4. gcf-merge-on-green
    added a commit that references this issue on May 20, 2021

    fix: fix datetime comparison unit tests (#898)

    This issue will close once commit 81932a2 is merged into the 'main' branch.
    81932a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @busunkim96
    busunkim96

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.