Changeset 4324:f5918d24b2fc in livinglogic.python.xist

Show
Ignore:
Timestamp:
02/09/11 15:46:42 (8 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add tests for str(date).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • test/test_ul4.py

    r4323 r4324  
    803803    with raises("str.*unknown"): 
    804804        r(u"<?print str(1, 2)?>") 
    805     assert "" == r(u"<?print str(data)?>", data=None) 
    806     assert "True" == r(u"<?print str(data)?>", data=True) 
    807     assert "False" == r(u"<?print str(data)?>", data=False) 
    808     assert "42" == r(u"<?print str(data)?>", data=42) 
    809     assert "4.2" == r(u"<?print str(data)?>", data=4.2) 
    810     assert "foo" == r(u"<?print str(data)?>", data="foo") 
     805    code = u"<?print str(data)?>" 
     806    assert "" == r(code, data=None) 
     807    assert "True" == r(code, data=True) 
     808    assert "False" == r(code, data=False) 
     809    assert "42" == r(code, data=42) 
     810    assert "4.2" == r(code, data=4.2) 
     811    assert "foo" == r(code, data="foo") 
     812    assert "2011-02-09" == r(code, data=datetime.date(2011, 2, 9)) 
     813    assert "2011-02-09 12:34:56" == r(code, data=datetime.datetime(2011, 2, 9, 12, 34, 56)) 
     814    assert "2011-02-09 12:34:56.987000" == r(code, data=datetime.datetime(2011, 2, 9, 12, 34, 56, 987000)) 
    811815 
    812816