Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_that_from_datetime_rejets_naive_datetimes doesn't raise although it should #31

Open
charmoniumQ opened this issue Dec 27, 2024 · 0 comments

Comments

@charmoniumQ
Copy link

Test output
======================================================================
FAIL: utcdatetime.tests.test_from_datetime.test_that_from_datetime_rejets_naive_datetimes
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/h8h15jlcqxgxp6jv3r5m2kywy1l56b9y-python3.10-nose-1.3.7/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/build/utcdatetime-0.0.7/utcdatetime/tests/test_from_datetime.py", line 28, in test_that_from_datetime_rejets_naive_datetimes
    assert_raises(ValueError, lambda: utcdatetime.from_datetime(
AssertionError: ValueError not raised by <lambda>

----------------------------------------------------------------------
Ran 120 tests in 0.073s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=120 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=120 errors=0 failures=1>

utcdatetime.from_datetime is defined as

    @classmethod
    def from_datetime(cls, dt):
        dt_utc = dt.astimezone(UTC)
        ...

According to Python documentation

Changed in version 3.6: The astimezone() method can now be called on naive instances that are presumed to represent system local time.

Presumably this would raise an ValueError before 3.6, but it does not in any newer Pythons.

charmoniumQ added a commit to charmoniumQ/python-utcdatetime that referenced this issue Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant