00001 # This file is Copyright 2010 Dean Hall. 00002 # 00003 # This file is part of the Python-on-a-Chip program. 00004 # Python-on-a-Chip is free software: you can redistribute it and/or modify 00005 # it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. 00006 # 00007 # Python-on-a-Chip is distributed in the hope that it will be useful, 00008 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 # A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 00011 # is seen in the file COPYING up one directory from this. 00012 00013 # 00014 # System Test 334 00015 # 00016 00017 print "hex(42) == %x" % 42 00018 00019 a = 42 00020 s = "%x" % a 00021 print s 00022 assert s == "2a" 00023 00024 S = "%X" % a 00025 print S 00026 assert S == "2A" 00027 00028 # For now, expect TypeError, in future, convert float to int and expect it to work 00029 print "Expect TypeError" 00030 b = 3.14 00031 p = "%x" % b 00032 assert p == "3"