Giter Site home page Giter Site logo

Unit test failed with r253 about pyv8 HOT 7 CLOSED

wmingjian avatar wmingjian commented on June 16, 2024
Unit test failed with r253

from pyv8.

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
Could verify with latest v8 and pyv8 SVN code, I can't reproduce it on Windows 
and 
Debian/Linux x86. 

Original comment by [email protected] on 11 Apr 2010 at 12:42

  • Changed state: Invalid

from pyv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
Looks like a daylight saving time related problem. I've added:
print str(func(now)), str(now.strftime("%a %b %d %Y %H:%M:%S"))
before assertion and got this:

gauss@pmain:~/Projects/pyv8$ date
Вск Апр 11 19:08:05 MSD 2010

gauss@pmain:~/Projects/pyv8$ python PyV8.py
.....................Sun Apr 11 2010 20:08:54 GMT+0400 (MSD) Sun Apr 11 2010 
19:08:54
F..............
======================================================================
FAIL: testDate (__main__.TestWrapper)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "PyV8.py", line 1006, in testDate
    self.assert_(str(func(now)).startswith(now.strftime("%a %b %d %Y %H:%M:%S")))
AssertionError

----------------------------------------------------------------------
Ran 36 tests in 12.429s

FAILED (failures=1)

Original comment by [email protected] on 11 Apr 2010 at 3:12

from pyv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
Thanks for your feedback, I will study the daylight saving time more detail 
later :)

Original comment by [email protected] on 12 Apr 2010 at 1:37

  • Changed state: Accepted
  • Added labels: Component-Logic, OpSys-All

from pyv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
I have debug the issue on a debian 5, it seems v8 and python use different time 
zone, it is very strange, I need check their code for more detail. :S

Original comment by [email protected] on 17 Jun 2010 at 4:13

from pyv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
import datetime
import PyV8


class Global(PyV8.JSClass):
    def now(self):
        return datetime.datetime.now()

ctx = PyV8.JSContext(Global())  # create another context with the global object
ctx.enter()
javascript_now = ctx.eval("new Date()")
javascript_global_now = ctx.eval("now()")
python_now = datetime.datetime.now()
print("javascript_global_now=%s" % javascript_global_now)
print("javascript_now=%s" % javascript_now)
print("python_now=%s" % python_now)

Outputs three different timezones on MacOSX:
javascript_global_now=2012-07-21 08:20:06.104000
javascript_now=2012-07-21 07:20:06.103000
python_now=2012-07-21 01:20:06.104915

Original comment by [email protected] on 21 Jul 2012 at 7:21

from pyv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
Same here with 

javascript_global_now=2012-08-27 08:15:01.376000
javascript_now=2012-08-27 07:15:01.376000
python_now=2012-08-27 09:15:01.376350

Python now is actually the correct time.

Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:        12.04
Codename:       precise


Original comment by [email protected] on 27 Aug 2012 at 7:16

from pyv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 16, 2024
force to use summer (i.e., Daylight Saving) time, contribute by
Russell

Original comment by [email protected] on 17 Apr 2013 at 4:38

  • Changed state: Fixed

from pyv8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.