On Saturday, September 1, 2012 12:19:10 AM UTC+8, Chris Withers wrote:
> On 23/08/2012 12:25, Tigerstyle wrote:
>
> > class FileTest(unittest.TestCase):
>
> >
>
> > def setUp(self):
>
> > self.origdir = os.getcwd()
>
> > self.dirname = tempfile.mkdtemp("testdir")
>
> >
On 23/08/2012 12:25, Tigerstyle wrote:
class FileTest(unittest.TestCase):
def setUp(self):
self.origdir = os.getcwd()
self.dirname = tempfile.mkdtemp("testdir")
os.chdir(self.dirname)
I wouldn't change directories like this, it's pretty fragile, just use
absolu
Ahh,
thank you very much Rob.
Fixed now.
Have a great day.
T
kl. 19:51:54 UTC+2 søndag 26. august 2012 skrev Rob Day følgende:
> On Sun, 2012-08-26 at 10:36 -0700, Tigerstyle wrote:
>
> > self.assertEqual(statinfo.st_size, filesize)
>
> >
>
> > I'm still getting AssertionEr
On Sun, 2012-08-26 at 10:36 -0700, Tigerstyle wrote:
> self.assertEqual(statinfo.st_size, filesize)
>
> I'm still getting AssertionError and the error says: 100 !=b'
>
>
filesize is the character 'b' repeated one million times (the contents
of the file, in other words). statinfo
Thanks Rob,
I'v modified the test_3 like this:
def test_3(self):
f = open("test.dat", "wb")
filesize = (b'b'*100)
f.write(filesize)
f.close()
statinfo = os.stat("test.dat")
self.assertEqual(statinfo.st_size, filesize)
I'm still getting
On Fri, 2012-08-24 at 09:20 -0700, Tigerstyle wrote:
> def test_3(self):
> f = open("test.dat", "wb")
> filesize = b"0"*100
> f.write(filesize)
> f.close()
> self.assertEqual(os.stat, filesize)
> The test_3 is to test if the created binary file har
Thank you guys, Roy and Terry.
I has been great help.
I still need some help. Here is the updated code:
Demostration of setUp and tearDown.
The tests do not actually test anything - this is a demo.
"""
import unittest
import tempfile
import shutil
import glob
import os
class FileTest(unittest.
On Thursday, August 23, 2012 1:29:19 PM UTC-4, Terry Reedy wrote:
> One can start with a set rather than tuple of file names.
> filenames = {"this.txt", "that.txt", "the_other.txt"}
Yeah, that's even cleaner. Just be aware, the set notation above is only
available in (IIRC), 2.7 or abo
On 8/23/2012 8:28 AM, Roy Smith wrote:
I think you want to end up with something like:
def test_1(self):
"Verify creation of files is possible"
filenames = ("this.txt", "that.txt", "the_other.txt")
for filename in filenames:
f = open(filename, "w")
In article <6b0299df-bc24-406b-8d69-489e990d8...@googlegroups.com>,
Tigerstyle wrote:
> Hi.
>
> I need help with an assignment and I hope you guys can guide me in the right
> direction.
> [code elided]
> 1. The test_1() method includes code to verify that the test directory
> contains only th
Hi.
I need help with an assignment and I hope you guys can guide me in the right
direction.
This is the code:
--
"""
Demostration of setUp and tearDown.
The tests do not actually test anything - this is a demo.
"""
import unittest
import tempfile
import shutil
import glob
import
11 matches
Mail list logo