diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-02-03 10:55:20 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-02-03 10:55:20 +0100 |
| commit | d3ea76a031fd9cb804741ec9955eccbbdb5f16f7 (patch) | |
| tree | b565646080493851dba46601dbd7ae4b9b2100f1 | |
| parent | 6f538d96ec35e80e19f1b33cad86b9ae45da54f5 (diff) | |
| download | python-apt-d3ea76a031fd9cb804741ec9955eccbbdb5f16f7.tar.gz | |
* tests/test_tagfile.py:
- add test for apt_pkg.TagFile() both for compressed/uncompressed
files
| -rw-r--r-- | debian/changelog | 3 | ||||
| -rw-r--r-- | tests/data/tagfile/history.1.log.gz | bin | 0 -> 270 bytes | |||
| -rw-r--r-- | tests/data/tagfile/history.log | 15 | ||||
| -rw-r--r-- | tests/test_tagfile.py | 35 |
4 files changed, 53 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 17fe379e..89c07119 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ python-apt (0.8.4) UNRELEASED; urgency=low - use apt_inst for reading the control_filelist * debian/control: - remove no longer needed dependency on python-debian + * tests/test_tagfile.py: + - add test for apt_pkg.TagFile() both for compressed/uncompressed + files -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 04 Jan 2012 12:07:48 +0100 diff --git a/tests/data/tagfile/history.1.log.gz b/tests/data/tagfile/history.1.log.gz Binary files differnew file mode 100644 index 00000000..4174e02b --- /dev/null +++ b/tests/data/tagfile/history.1.log.gz diff --git a/tests/data/tagfile/history.log b/tests/data/tagfile/history.log new file mode 100644 index 00000000..f1d72665 --- /dev/null +++ b/tests/data/tagfile/history.log @@ -0,0 +1,15 @@ + +Start-Date: 2012-02-01 13:54:52 +Commandline: apt-get install chromium-browser +Install: chromium-browser:amd64 (16.0.912.77~r118311-0ubuntu1), chromium-browser-l10n:amd64 (16.0.912.77~r118311-0ubuntu1, automatic), chromium-codecs-ffmpeg:amd64 (16.0.912.77~r118311-0ubuntu1, automatic) +End-Date: 2012-02-01 13:55:01 + +Start-Date: 2012-02-02 10:39:04 +Commandline: apt-get install python-geoclue +Install: python-geoclue:amd64 (0.1.0-4build1) +End-Date: 2012-02-02 10:39:08 + +Start-Date: 2012-02-03 10:20:50 +Commandline: apt-get install python-qt4 +Install: python-qt4:amd64 (4.9-3ubuntu1) +End-Date: 2012-02-03 10:20:55 diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py new file mode 100644 index 00000000..b0b5cbdc --- /dev/null +++ b/tests/test_tagfile.py @@ -0,0 +1,35 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Michael Vogt <mvo@ubuntu.com> +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +"""Unit tests for verifying the correctness of apt_pkg.TagFile""" + +import unittest + +from test_all import get_library_dir +import sys +sys.path.insert(0, get_library_dir()) + +import apt_pkg + +class TestTagFile(unittest.TestCase): + """ test the apt_pkg.TagFile """ + + def test_tag_file(self): + tagfile = apt_pkg.TagFile(open("./data/tagfile/history.log")) + for i, stanza in enumerate(tagfile): + pass + self.assertEqual(i, 2) + + def test_tag_file_compressed(self): + tagfile = apt_pkg.TagFile(open("./data/tagfile/history.1.log.gz")) + for i, stanza in enumerate(tagfile): + #print stanza + pass + self.assertEqual(i, 2) + +if __name__ == "__main__": + unittest.main() |
