Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27821
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <robertkday@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'binary': 0.05; 'bytes.': 0.07; 'f.close()': 0.07; 'python': 0.09; 'argument,': 0.09; 'def': 0.10; '2.7.3': 0.16; 'received:mail-wi0-f178.google.com': 0.16; 'wrote:': 0.17; 'working.': 0.17; '>>>': 0.18; 'import': 0.21; '(you': 0.23; 'testing': 0.24; 'header:In-Reply-To:1': 0.25; 'received:209.85.212': 0.28; '-0700,': 0.29; 'fri,': 0.30; 'function': 0.30; 'url:python': 0.32; 'file': 0.32; 'to:addr :python-list': 0.33; 'equal': 0.33; 'received:google.com': 0.34; 'path': 0.35; 'received:192.168.0': 0.35; 'received:209.85': 0.35; 'created': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'test': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'is.': 0.62; 'more': 0.63; 'jul': 0.65; 'million': 0.72 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:in-reply-to:references:content-type :x-mailer:mime-version:content-transfer-encoding; bh=TDmPOWkD+QDQ62nH0b+HalIeKJeqoWZZ3pXmWYmI0/g=; b=cFKvEe9/MM3xXgiCu2TkGqTpntJ/e1DbL3S2UHzC/X/grhhfpgkbiwQ1tEsCjE4/dL A8REjcZCDM4cQWmnQD03YLCKynhetUQMust2ZpcA0HMlPJl38/3NqPYyNhs5ll4ABTs6 bQuwMQyk1iHEZw20DbjFZ5NdUJUM9BlryFGyRZBUvo3n9sNO5XxuQrU2WWUkZKJj8cJ4 z72mKEZ52q53gRF4IXMAUNAMM4/RLqNuHqoyTHU2N5efo55d8wWO0+0Fh80E2Rh53Zgk XwU9FdJDMxKIYgReeTZPpfc3Q1wyFHxA+rWLRa1n7EsM0yfDvP4wdsIZctvx8UY+n97j /NhA== |
| Subject | Re: Unittest - testing for filenames and filesize |
| From | Robert Day <robertkday@gmail.com> |
| To | python-list@python.org |
| Date | Fri, 24 Aug 2012 20:04:54 +0100 |
| In-Reply-To | <8447c547-8472-48c6-ad78-87989c1ce288@googlegroups.com> |
| References | <6b0299df-bc24-406b-8d69-489e990d8e4f@googlegroups.com> <roy-CDABA6.08285523082012@news.panix.com> <mailman.3724.1345742998.4697.python-list@python.org> <mailman.3728.1345748791.4697.python-list@python.org> <8447c547-8472-48c6-ad78-87989c1ce288@googlegroups.com> |
| Content-Type | text/plain; charset="UTF-8" |
| X-Mailer | Evolution 3.4.3 (3.4.3-2.fc17) |
| Mime-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3766.1345835099.4697.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1345835099 news.xs4all.nl 6916 [2001:888:2000:d::a6]:47767 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:27821 |
Show key headers only | View raw
On Fri, 2012-08-24 at 09:20 -0700, Tigerstyle wrote:
> def test_3(self):
> f = open("test.dat", "wb")
> filesize = b"0"*1000000
> f.write(filesize)
> f.close()
> self.assertEqual(os.stat, filesize)
> The test_3 is to test if the created binary file har the size of 1 million bytes. Somehow it is not working. Any suggestions?
>
rob@rivertam:~$ python
Python 2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.stat
<built-in function stat>
>>>
So that's what 'os.stat' is. Why are you testing whether that's equal to
b"0"*1000000?
(You may find the documentation on os.stat at
http://docs.python.org/library/os.html#os.stat helpful; it's a function
which takes a path as its argument, and returns an object with some
relevant attributes.)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-23 04:25 -0700
Re: Unittest - testing for filenames and filesize Roy Smith <roy@panix.com> - 2012-08-23 08:28 -0400
Re: Unittest - testing for filenames and filesize Terry Reedy <tjreedy@udel.edu> - 2012-08-23 13:29 -0400
Re: Unittest - testing for filenames and filesize Roy Smith <roy@panix.com> - 2012-08-23 12:06 -0700
Re: Unittest - testing for filenames and filesize Roy Smith <roy@panix.com> - 2012-08-23 12:06 -0700
Re: Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-24 09:20 -0700
Re: Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-24 09:20 -0700
Re: Unittest - testing for filenames and filesize Robert Day <robertkday@gmail.com> - 2012-08-24 20:04 +0100
Re: Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-26 10:36 -0700
Re: Unittest - testing for filenames and filesize Rob Day <rkd@rkd.me.uk> - 2012-08-26 18:51 +0100
Re: Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-26 11:37 -0700
Re: Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-26 11:37 -0700
Re: Unittest - testing for filenames and filesize Tigerstyle <laddosingh@gmail.com> - 2012-08-26 10:36 -0700
Re: Unittest - testing for filenames and filesize Chris Withers <chris@python.org> - 2012-08-31 17:19 +0100
Re: Unittest - testing for filenames and filesize 88888 Dihedral <dihedral88888@googlemail.com> - 2012-08-31 22:08 -0700
Re: Unittest - testing for filenames and filesize 88888 Dihedral <dihedral88888@googlemail.com> - 2012-08-31 22:08 -0700
csiph-web