[Python-modules-commits] [dbf] 02/10: Import dbf_0.96.8.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Tue Aug 16 22:05:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository dbf.

commit 1a210a0cf8c94f669ff76ac515c4ea810e78a63f
Author: Sandro Tosi <morph at debian.org>
Date:   Tue Aug 16 19:44:51 2016 +0100

    Import dbf_0.96.8.orig.tar.gz
---
 PKG-INFO                          |   8 +-
 PKG-INFO => dbf.egg-info/PKG-INFO |   8 +-
 dbf.egg-info/SOURCES.txt          |  12 ++
 dbf.egg-info/dependency_links.txt |   1 +
 dbf.egg-info/requires.txt         |   1 +
 dbf.egg-info/top_level.txt        |   1 +
 dbf/README.md                     | 128 -----------------
 dbf/WHATSNEW                      | 293 --------------------------------------
 dbf/__init__.py                   |   2 +-
 dbf/_index.py                     | 185 ++++++++++++++++++++++++
 dbf/{tests.py => test.py}         | 151 +++++++++++++++++---
 dbf/ver_2.py                      |  54 +++----
 dbf/ver_32.py                     | 255 +++++++++++++++++++++++++++++----
 dbf/ver_33.py                     | 255 +++++++++++++++++++++++++++++----
 setup.cfg                         |   5 +
 setup.py                          |  44 +++---
 16 files changed, 863 insertions(+), 540 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 8426927..60e411d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: dbf
-Version: 0.96.005
+Version: 0.96.8
 Summary: Pure python package for reading/writing dBase, FoxPro, and Visual FoxPro .dbf files (including memos)
 Home-page: https://pypi.python.org/pypi/dbf
 Author: Ethan Furman
@@ -21,8 +21,8 @@ Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python
 Classifier: Topic :: Database
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Provides: dbf
diff --git a/PKG-INFO b/dbf.egg-info/PKG-INFO
similarity index 87%
copy from PKG-INFO
copy to dbf.egg-info/PKG-INFO
index 8426927..60e411d 100644
--- a/PKG-INFO
+++ b/dbf.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: dbf
-Version: 0.96.005
+Version: 0.96.8
 Summary: Pure python package for reading/writing dBase, FoxPro, and Visual FoxPro .dbf files (including memos)
 Home-page: https://pypi.python.org/pypi/dbf
 Author: Ethan Furman
@@ -21,8 +21,8 @@ Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python
 Classifier: Topic :: Database
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Provides: dbf
diff --git a/dbf.egg-info/SOURCES.txt b/dbf.egg-info/SOURCES.txt
new file mode 100644
index 0000000..fa10418
--- /dev/null
+++ b/dbf.egg-info/SOURCES.txt
@@ -0,0 +1,12 @@
+setup.py
+dbf/__init__.py
+dbf/_index.py
+dbf/test.py
+dbf/ver_2.py
+dbf/ver_32.py
+dbf/ver_33.py
+dbf.egg-info/PKG-INFO
+dbf.egg-info/SOURCES.txt
+dbf.egg-info/dependency_links.txt
+dbf.egg-info/requires.txt
+dbf.egg-info/top_level.txt
\ No newline at end of file
diff --git a/dbf.egg-info/dependency_links.txt b/dbf.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/dbf.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/dbf.egg-info/requires.txt b/dbf.egg-info/requires.txt
new file mode 100644
index 0000000..93e06fa
--- /dev/null
+++ b/dbf.egg-info/requires.txt
@@ -0,0 +1 @@
+aenum
diff --git a/dbf.egg-info/top_level.txt b/dbf.egg-info/top_level.txt
new file mode 100644
index 0000000..8e823fe
--- /dev/null
+++ b/dbf.egg-info/top_level.txt
@@ -0,0 +1 @@
+dbf
diff --git a/dbf/README.md b/dbf/README.md
deleted file mode 100644
index ae4e684..0000000
--- a/dbf/README.md
+++ /dev/null
@@ -1,128 +0,0 @@
-dbf
-===
-
-dbf (also known as python dbase) is a module for reading/writing
-dBase III, FP, VFP, and Clipper .dbf database files.  It's
-an ancient format that still finds lots of use (the most common
-I'm aware of is retrieving legacy data so it can be stored in a
-newer database system; other uses include GIS, stand-alone programs
-such as Family History, Personal Finance, etc.).
-
-Highlights
-----------
-
-Table -- represents a single .dbf/.dbt (or .fpt) file combination
-and provides access to records; suports the sequence access and 'with'
-protocols.  Temporary tables can also live entirely in memory.
-
-Record -- repesents a single record/row in the table, with field access
-returning native or custom data types; supports the sequence, mapping,
-attribute access (with the field names as the attributes), and 'with'
-protocols.  Updates to a record object are reflected on disk either
-immediately (using gather() or write()), or at the end of a 'with'
-statement.
-
-Index -- nonpersistent index for a table.
-
-Fields::
-
-    dBase III (Null not supported)
-
-        Character --> unicode
-        Date      --> datetime.date or None
-        Logical   --> bool or None
-        Memo      --> unicode or None
-        Numeric   --> int/float depending on field definition or None
-
-        Float     --> same as numeric
-
-    Clipper (Null not supported)
-
-        Character --> unicode  (character fields can be up to 65,519)
-
-    Foxpro (Null supported)
-
-        General   --> str (treated as binary)
-        Picture   --> str (treated as binary)
-
-    Visual Foxpro (Null supported)
-
-        Currency  --> decimal.Decimal
-        douBle    --> float
-        Integer   --> int
-        dateTime  --> datetime.datetime
-
-    If a field is uninitialized (Date, Logical, Numeric, Memo, General,
-    Picture) then None is returned for the value.
-
-Custom data types::
-
-    Null     -->  used to support Null values
-
-    Char     -->  unicode type that auto-trims trailing whitespace, and
-                  ignores trailing whitespace for comparisons
-
-    Date     -->  date object that allows for no date
-
-    DateTime -->  datetime object that allows for no datetime
-
-    Time     -->  time object that allows for no time
-
-    Logical  -->  adds Unknown state to bool's: instead of True/False/None,
-                  values are Truth, Falsth, and Unknown, with appropriate
-                  tri-state logic; just as bool(None) is False, bool(Unknown)
-                  is also False;  the numerical values of Falsth, Truth, and
-                  Unknown is 0, 1, 2
-
-    Quantum  -->  similar to Logical, but implements boolean algebra (I think).
-                  Has states of Off, On, and Other.  Other has no boolean nor
-                  numerical value, and attempts to use it as such will raise
-                  an exception
-
-
-Whirlwind Tour
---------------
-
-    import datetime
-    import dbf
-
-    table = dbf.Table(
-            filename='test',
-            field_specs='name C(25); age N(3,0); birth D; qualified L',
-            on_disk=False,
-            )
-    table.open()
-
-    for datum in (
-            ('Spanky', 7, dbf.Date.fromymd('20010315'), False),
-            ('Spunky', 23, dbf.Date(1989, 07, 23), True),
-            ('Sparky', 99, dbf.Date(), dbf.Unknown),
-            ):
-        table.append(datum)
-
-    for record in table:
-        print record
-        print '--------'
-        print record[0:3]
-        print record['name':'qualified']
-        print [record.name, record.age, record.birth]
-        print '--------'
-
-    custom = table.new(
-            filename='test_on_disk',
-            default_data_types=dict(C=dbf.Char, D=dbf.Date, L=dbf.Logical),
-            )
-
-    with custom:    # automatically opened and closed
-        for record in table:
-            custom.append(record)
-        for record in custom:
-            dbf.write(record, name=record.name.upper())
-            print record
-            print '--------'
-            print record[0:3]
-            print record['name':'qualified']
-            print [record.name, record.age, record.birth]
-            print '--------'
-
-    table.close()
diff --git a/dbf/WHATSNEW b/dbf/WHATSNEW
deleted file mode 100644
index 9b3211f..0000000
--- a/dbf/WHATSNEW
+++ /dev/null
@@ -1,293 +0,0 @@
-What's New
-==========
-
-0.96.000
---------
-
-add support for Python 3
-convert from module to package layout
-remove pql
-fix Time and DateTime signatures: microsec --> microseconds
-fix Time and DateTime .now() to truncate microseconds past thousands
-
-
-0.95.014
---------
-
-use a sparse container for the table -- should make very large dbf files usable
-
-
-0.95.013
---------
-
-Null fields properly ignored if table doesn't support it
-
-
-0.95.012
---------
-
-adjust setup.py to require enum34
-
-add custom data types to xmlrpclib.Marshaller (marshalled as the underlying
-type)
-
-add support for storing numbers as scientific notation
-
-fixed DateTime.now() and Time.now() to only return milliseconds
-
-
-0.95.008
---------
-
-fix Period.__contains__
-
-add new default_data_type to Table.__init__ of 'enhanced' which selects all
-the custom data types (Char, Logical, Date, DateTime)
-
-add string input type to Date, Time, and DateTime
-
-
-0.95.007
---------
-
-Add .fromfloat() to Time
-
-Add .tofloat() to Time
-
-Add Period for matching various time periods 
-
-
-0.95.006
---------
-
-Add .format() and .replace() to Date, Time, and DateTime
-
-Add nesting to Table context manager
-
-Add enumerations IsoDay, RelativeDay, IsoMonth, RelativeMonth
-
-
-0.95.003
---------
-
-Fixed issue with incorrect memo size in base file (thanks, Glenn!)
-
-Memo file extensions now have the same casing as the dbf file's, and are
-searched for that way (thanks again, Glenn!)
-
-
-0.95.002
---------
-
-Fixed the version number in this file for the last release. :/
-
-string slices now work for RecordTemplate
-
-
-0.95.001
---------
-
-Miscellaneous bugs squashed.
-
-backup tables are created in the same location as the original table if TMP,
-TEMP, nor DBF_TEMP are defined in the environment
-
-delete() and undelete() now support RecordTemplate
-
-Process() and Templates() now support start, stop, and filter to allow finer
-control of which records will be returned.
-
-Added Relation, which makes linking two tables together on a common field easier.
-Not persistent.
-
-xBase-Compatibility Break: added utf8 codepage (xf0).
-
-Backwards-Compatibility Break: reverted Logical.__eq__ to return True if Logical
-is True, False otherwise; this properly mimics the behavior of using True/False/None
-directly.  If the previous behavior is desired, use Quantum instead (it uses the
-states On/Off/Other), or use `if some_var is Unknown: ... ; elif some_var ... ; else ... `.
-
-Many thanks to all who have helped with ideas and bug fixes.
-
-
-0.94.004
---------
-
-Templates now use same (custom) data types as table they are created
-from.
-
-Added Index.index_search(match, start=None, stop=None, nearest=False, partial=False)
-which returns the index of the first match.  If nearest is False and nothing is found
-a NotFoundError is raised, otherwise the index of where the match would be is
-returned
-
-Added IndexLocation, which is a subclass of long and is returned by Index.index_search.
-Unlike normal numbers where 0 == False and anything else == True, IndexLocation is True if
-the number represents a found match, and False if the number represents where a match
-should be (a False value will only be returned if nearest == True).
-
-Backwards-Compatibility Break: memory-only tables are now specified with on_disk=True
-instead of bracketing the filename with ':'.  Removed dbf.codepage() and dbf.encoding()
-as users can directly access dbf.default_codepage and dbf.input_decoding.
-
-Backwards-Compatibility Break: .use_deleted no longer used (it disappeared sometime
-between .90.0 and now). Rationale: the deleted flag is just that: a flag.  The record is
-still present and still available.  If you don't want to use it, either check if the
-record has been deleted (dbf.is_deleted(record)) or create an index that doesn't include
-the deleted records... or pack the table and actually remove the records for good.
-
-
-0.94.003
---------
-
-Minor bug fixes, more documentation.
-
-
-0.94.001
---------
-
-Added support for Clipper's large Character fields (up to 65,519)
-
-More code clean-up and slight breakage::
-
-    - _Dbf* has had '_Dbf' removed  (_DbfRecord --> Record)
-    - DbfTable --> Table (Table factory function removed)
-
-
-0.94.000
---------
-
-Massive backwards incompatible changes.
-
-export() method removed from Tables and made into a normal function.
-
-All non-underscore methods removed from the record class and made into
-normal functions::
-
-    - delete_record --> delete
-    - field_names --> field_names
-    - gather_records --> gather
-    - has_been_deleted --> is_deleted
-    - record_number --> recno
-    - reset_record --> reset
-    - scatter_records --> scatter
-    - undelete_record --> undelete
-    - write_record --> write
-
-Transaction methods removed entirely.
-
-Can use strings as start/stop of slices: `record['name':'age']`
-
-Record templates now exist, and are much like records except that they are
-not directly tied to a table and can be freely modified.  They can be created
-by either the `dbf.create_template` function or the `table.create_template` method.
-
-scatter() now returns a RecordTemplate instead of a dict, but the as_type parameter
-can be used to get dicts (or tuples, lists, whatever)
-
-
-0.93.020
---------
-    Finished changes so other Python implementations should work (PyPy
-    definitely does).
-
-    Table signature changed -- `read_only`, `meta_only`, and `keep_memos`
-    dropped.
-
-    tables now have a `status` attribute which will be one of `closed`,
-    'read_only`, or `read_write`
-
-    `.append` no longer returns the newly added record (use table[-1] if you need it)
-    `.find` method removed (use `.query` instead);
-    `.sql` method removed (use `.query` instead);
-    `.size` renamed to `.field_size`;
-    `.type` renamed to `.field_type` (which returns a FieldType named tuple);
-
-    the way to change records has changed:
-
-        to update any/all fields at once:
-            record.write_record(field1=..., field2=...)
-
-            or
-
-            record.gather_fields(dict)
-
-        to update one field at a time:
-            2.6, 2.7 (2.5 using `from __future__ import with_statement`)
-            with record:
-                record.field1 = ...
-                record.field2 = ...
-
-            or
-
-            for record in dbf.Process(table | records):
-                record.field1 = ...
-                record.field2 = ...
-
-    attempting to change a field outside of these two methods will raise a
-    `DbfError`.
-
-    Changing behavior based on a transaction:
-
-        record.gather_fields()
-
-            if a transaction is not running this will write to disk
-            (no changes made if error occurs, exception reraised)
-
-            if a transaction is running, and an error occurs, the calling code
-            is responsible for calling .rollback_transaction() or otherwise
-            handling the problem (exception is reraised)
-
-        record.reset_record()
-
-            if a transaction is not running the changes are written to disk
-
-            if a transaction is running the changes are not written to disk
-
-    `xxx in table` and `xxx in record` used to be a field-name check - it is
-    now a record / value check; use `xxx in table.field_names` and
-    `xxx in record.field_names` to do the field-name check.
-
-    added equality/inequality check for records, which can be compared against
-    other records / dicts / tuples (field/key order does not matter for
-    record-record nor record-dict checks).
-
-
-0.93.011
---------
-    `with` will work now.  Really.
-
-    Started making changes so dbf will work with the non-CPython
-    implementations (at this point it is not reliable).
-
-
-0.93.010
---------
-    Table now returns a closed database; .open() must now be called before
-    accessing the records.
-    Note: fields, number of records, table type, and other metadata is
-    available on closed tables.
-
-    Finished adding support for 'F' (aka 'N') field types in dBase III tables;
-    this is a practicality beats purity issue as the F type is not part of the
-    db3 standard, but is exactly the same as N and other programs will use it
-    instead of N when creating db3 tables.
-
-
-0.93.000
---------
-    PEP 8 changes (yo --> self, someMethod --> some_method)
-
-
-0.92.002
---------
-    added more support for the Null type in the other custome data types
-
-
-0.91.001
---------
-    Removed __del__ from dbf records; consequently they no longer autosave when
-    going out of scope.  Either call .write_record() explicitly, or use the new
-    Write iterator which will call .write_record for you.
-
-    Finished adding Null support (not supported in db3 tables)
diff --git a/dbf/__init__.py b/dbf/__init__.py
index 73ca282..ec804e0 100644
--- a/dbf/__init__.py
+++ b/dbf/__init__.py
@@ -1,6 +1,6 @@
 import sys as _sys
 
-version = (0, 96, 5)
+version = 0, 96, 8
 
 py_ver = _sys.version_info[:2]
 if py_ver >= (3, 3):
diff --git a/dbf/_index.py b/dbf/_index.py
new file mode 100644
index 0000000..6894106
--- /dev/null
+++ b/dbf/_index.py
@@ -0,0 +1,185 @@
+class IndexFile(object):
+    "provides read/write access to a custom index file."
+    _last_header_block = 0       # block to write new master index entries
+    _free_node_chain = 0         # beginning of free node chain
+    indices = None              # indices in this file
+    def __init__(self, dbf):
+        "creates .pdx file if it doesn't exist"
+        filename = os.path.splitext(dbf.filename)[0]
+        filename += '.pdx'
+        if not os.path.exists(filename):
+            self.index_file = open(filename, 'r+b')
+            self.index_file.write('\xea\xaf\x37\xbf'    # signature
+                '\x00'*8                                # two non-existant lists
+                '\x00'*500)                             # and no indices
+            return
+        index_file = self.index_file = open(filename, 'r+b')
+        header = index_file.read(512)
+        if header[:4] != '\xea\xaf\x37\xbf':
+            raise IndexFileError("Wrong signature -- unable to use index file %r" % filename)
+        more_header = unpack_long_int(header[4:8])
+        free_nodes = self.free_nodes = unpack_long_int(header[8:12])
+        indices = header[12:]
+        while more_header:
+            self.last_header_block = more_header    # block to add new indices to
+            index_file.seek(more_header)
+            header = index_file.read(512)
+            more_header = unpack_long_int(header[:4])
+            indices += header[4:]
+
+class ContainedIndex(_Navigation):
+    "an individual index in a .pdx (plentiful index) file"
+    def __init__(self, table, key_func, key_text, index_file, root_node, id):
+        self.__doc__ = key_text
+        self._meta = table._meta      # keep for other info functions
+        self.key = key_func
+        self.file = index_file
+        self.root = root_node
+        self.id = id
+
+
+
+
+    def __call__(self, record):
+        rec_num = recno(record)
+        key = self.key(record)
+        if not isinstance(key, tuple):
+            key = (key, )
+        if rec_num in self._records:
+            if self._records[rec_num] == key:
+                return
+            old_key = self._records[rec_num]
+            vindex = bisect_left(self._values, old_key)
+            self._values.pop(vindex)
+            self._rec_by_val.pop(vindex)
+            del self._records[rec_num]
+            assert rec_num not in self._records
+        if key == (DoNotIndex, ):
+            return
+        vindex = bisect_right(self._values, key)
+        self._values.insert(vindex, key)
+        self._rec_by_val.insert(vindex, rec_num)
+        self._records[rec_num] = key
+    def __contains__(self, data):
+        if not isinstance(data,(Record, RecordTemplate, tuple, dict)):
+            raise TypeError("%r is not a record, templace, tuple, nor dict" % (data, ))
+        if isinstance(data, Record) and source_table(data) is self._table:
+            return recno(data) in self._records
+        else:
+            try:
+                value = self.key(data)
+                return value in self._values
+            except Exception:
+                for record in self:
+                    if record == data:
+                        return True
+                return False
+    def __getitem__(self, key):
+        if isinstance(key, int):
+            count = len(self._values)
+            if not -count <= key < count:
+                raise IndexError("Record %d is not in list." % key)
+            rec_num = self._rec_by_val[key]
+            return self._table[rec_num]
+        elif isinstance(key, slice):
+            result = List()
+            start, stop, step = key.start, key.stop, key.step
+            if start is None: start = 0
+            if stop is None: stop = len(self._rec_by_val)
+            if step is None: step = 1
+            if step < 0:
+                start, stop = stop - 1, -(stop - start + 1)
+            for loc in range(start, stop, step):
+                record = self._table[self._rec_by_val[loc]]
+                result._maybe_add(item=(self._table, self._rec_by_val[loc], result.key(record)))
+            return result
+        elif isinstance (key, (str, unicode, tuple, Record)):
+            if isinstance(key, Record):
+                key = self.key(key)
+            elif not isinstance(key, tuple):
+                key = (key, )
+            loc = self.find(key)
+            if loc == -1:
+                raise KeyError(key)
+            return self._table[self._rec_by_val[loc]]
+        else:
+            raise TypeError('indices must be integers, match objects must by strings or tuples')
+    def __enter__(self):
+        self._table.open()
+        return self
+    def __exit__(self, *exc_info):
+        self._table.close()
+        return False
+    def __iter__(self):
+        return Iter(self)
+    def __len__(self):
+        return len(self._records)
+    def _clear(self):
+        "removes all entries from index"
+        self._values[:] = []
+        self._rec_by_val[:] = []
+        self._records.clear()
+    def _nav_check(self):
+        "raises error if table is closed"
+        if self._table._meta.status == CLOSED:
+            raise DbfError('indexed table %s is closed' % self.filename)
+    def _partial_match(self, target, match):
+        target = target[:len(match)]
+        if isinstance(match[-1], (str, unicode)):
+            target = list(target)
+            target[-1] = target[-1][:len(match[-1])]
+            target = tuple(target)
+        return target == match
+    def _purge(self, rec_num):
+        value = self._records.get(rec_num)
+        if value is not None:
+            vindex = bisect_left(self._values, value)
+            del self._records[rec_num]
+            self._values.pop(vindex)
+            self._rec_by_val.pop(vindex)
+    def _reindex(self):
+        "reindexes all records"
+        for record in self._table:
+            self(record)
+    def _search(self, match, lo=0, hi=None):
+        if hi is None:
+            hi = len(self._values)
+        return bisect_left(self._values, match, lo, hi)
+    def index(self, record, start=None, stop=None):
+        """returns the index of record between start and stop
+        start and stop default to the first and last record"""
+        if not isinstance(record, (Record, RecordTemplate, dict, tuple)):
+            raise TypeError("x should be a record, template, dict, or tuple, not %r" % type(record))
+        self._still_valid_check()
+        if start is None:
+            start = 0
+        if stop is None:
+            stop = len(self)
+        for i in range(start, stop):
+            if record == (self[i]):
+                return i
+        else:
+            raise NotFoundError("dbf.Index.index(x): x not in Index", data=record)
+    def query(self, criteria):
+        """criteria is a callback that returns a truthy value for matching record"""
+        return pql(self, criteria)
+    def search(self, match, partial=False):
+        "returns dbf.List of all (partially) matching records"
+        result = List()
+        if not isinstance(match, tuple):
+            match = (match, )
+        loc = self._search(match)
+        if loc == len(self._values):
+            return result
+        while loc < len(self._values) and self._values[loc] == match:
+            record = self._table[self._rec_by_val[loc]]
+            result._maybe_add(item=(self._table, self._rec_by_val[loc], result.key(record)))
+            loc += 1
+        if partial:
+            while loc < len(self._values) and self._partial_match(self._values[loc], match):
+                record = self._table[self._rec_by_val[loc]]
+                result._maybe_add(item=(self._table, self._rec_by_val[loc], result.key(record)))
+                loc += 1
+        return result
+
+
diff --git a/dbf/tests.py b/dbf/test.py
similarity index 97%
rename from dbf/tests.py
rename to dbf/test.py
index 1981b9a..b74bfa7 100644
--- a/dbf/tests.py
+++ b/dbf/test.py
@@ -139,7 +139,9 @@ def inactive(rec):
         return recno(rec)
     return DoNotIndex
 
+
 class TestChar(unittest.TestCase):
+
     def test_exceptions(self):
         "exceptions"
         self.assertRaises(ValueError, Char, 7)
@@ -149,6 +151,7 @@ class TestChar(unittest.TestCase):
         self.assertRaises(ValueError, Char, type)
         self.assertRaises(ValueError, Char, str)
         self.assertRaises(ValueError, Char, None)
+
     def test_bools_and_none(self):
         "booleans and None"
         empty = Char()
@@ -157,6 +160,7 @@ class TestChar(unittest.TestCase):
         self.assertFalse(bool(one))
         actual = Char('1')
         self.assertTrue(bool(actual))
+
     def test_equality(self):
         "equality"
         a1 = Char('a')
@@ -167,6 +171,7 @@ class TestChar(unittest.TestCase):
         a4 = Char('a ')
         self.assertEqual(a3, a4)
         self.assertEqual(a4, a3)
+
     def test_inequality(self):
         "inequality"
         a1 = Char('ab ')
@@ -177,6 +182,7 @@ class TestChar(unittest.TestCase):
         a4 = Char('a b')
         self.assertNotEqual(a3, a4)
         self.assertNotEqual(a4, a3)
+
     def test_less_than(self):
         "less-than"
         a1 = Char('a')
@@ -191,6 +197,7 @@ class TestChar(unittest.TestCase):
         a6 = 'abce'
         self.assertTrue(a5 < a6)
         self.assertFalse(a6 < a5)
+
     def test_less_than_equal(self):
         "less-than or equal"
         a1 = Char('a')
@@ -205,6 +212,7 @@ class TestChar(unittest.TestCase):
         a6 = 'abce'
         self.assertTrue(a5 <= a6)
         self.assertFalse(a6 <= a5)
+
     def test_greater_than(self):
         "greater-than or equal"
         a1 = Char('a')
@@ -219,6 +227,7 @@ class TestChar(unittest.TestCase):
         a6 = 'abce'
         self.assertFalse(a5 >= a6)
         self.assertTrue(a6 >= a5)
+
     def test_greater_than_equal(self):
         "greater-than"
         a1 = Char('a')
@@ -234,8 +243,10 @@ class TestChar(unittest.TestCase):
         self.assertFalse(a5 > a6)
         self.assertTrue(a6 > a5)
 
+
 class TestDateTime(unittest.TestCase):
     "Testing Date"
+
     def test_date_creation(self):
         "Date creation"
         date0 = Date()
@@ -248,6 +259,7 @@ class TestDateTime(unittest.TestCase):
         self.assertRaises(ValueError, Date.fromymd, '00000')
         self.assertRaises(ValueError, Date.fromymd, '00000000')
         self.assertRaises(ValueError, Date, 0, 0, 0)
+
     def test_date_compare(self):
         "Date comparisons"
         nodate1 = Date()
@@ -265,6 +277,7 @@ class TestDateTime(unittest.TestCase):
         datetime6 = DateTime.today()
         datetime7 = DateTime.max
         datetime8 = DateTime.min
+
     def test_datetime_compare(self):
         "DateTime comparisons"
         nodatetime1 = DateTime()
@@ -290,7 +303,6 @@ class TestDateTime(unittest.TestCase):
             datetime.datetime = DateTimeNow
             result = DateTime.now()
             self.assertEqual(result, datetime_target, 'in: %r  out: %r  desired: %r' % (dt, result, datetime_target))
-        
 
     def test_time_creation(self):
         "Time creation"
@@ -298,6 +310,7 @@ class TestDateTime(unittest.TestCase):
         time1 = Time()
         time7 = Time.max
         time8 = Time.min
+
     def test_time_compare(self):
         "Time comparisons"
         notime1 = Time()
@@ -306,6 +319,7 @@ class TestDateTime(unittest.TestCase):
         time2 = Date.fromordinal(2000)
         time3 = Date.fromordinal(3000)
         self.compareTimes(notime1, notime2, time1, time2, time3)
+
     def test_arithmetic(self):
         "Date, DateTime, & Time Arithmetic"
         one_day = datetime.timedelta(1)
@@ -323,6 +337,7 @@ class TestDateTime(unittest.TestCase):
         self.assertEqual(an_appt + displacement, DateTime(2012, 4, 16, 14, 45, 0))
         self.assertEqual(an_appt - displacement, DateTime(2012, 4, 14, 10, 15, 0))
         self.assertEqual(datetime.datetime(2012, 4, 16, 14, 45, 0) - an_appt, displacement)
+
     def test_none_compare(self):
         "comparisons to None"
         empty_date = Date()
@@ -331,6 +346,7 @@ class TestDateTime(unittest.TestCase):
         self.assertEqual(empty_date, None)
         self.assertEqual(empty_time, None)
         self.assertEqual(empty_datetime, None)
+
     def test_singletons(self):
         "singletons"
         empty_date = Date()
@@ -339,6 +355,7 @@ class TestDateTime(unittest.TestCase):
         self.assertTrue(empty_date is NullDate)
         self.assertTrue(empty_time is NullTime)
         self.assertTrue(empty_datetime is NullDateTime)
+
     def test_boolean_value(self):
         "boolean evaluation"
         empty_date = Date()
@@ -353,6 +370,7 @@ class TestDateTime(unittest.TestCase):
         self.assertEqual(bool(actual_date), True)
         self.assertEqual(bool(actual_time), True)
         self.assertEqual(bool(actual_datetime), True)
+
     def compareTimes(self, empty1, empty2, uno, dos, tres):
         self.assertEqual(empty1, empty2)
         self.assertEqual(uno < dos, True)
@@ -394,7 +412,9 @@ class TestDateTime(unittest.TestCase):
         self.assertEqual(dos != dos, False)
         self.assertEqual(tres != tres, False)
 
+
 class TestNull(unittest.TestCase):
+
     def test_all(self):
         null = Null = dbf.Null()
         self.assertTrue(null is dbf.Null())
@@ -503,6 +523,7 @@ class TestNull(unittest.TestCase):
 
 class TestLogical(unittest.TestCase):
     "Testing Logical"
+
     def test_unknown(self):
         "Unknown"
         for unk in '', '?', ' ', None, Null, Unknown, Other:
@@ -515,6 +536,7 @@ class TestLogical(unittest.TestCase):
             self.assertEqual(huh == False, False, "huh is %r from %r, which is not None" % (huh, unk))
             if py_ver >= (2, 5):
                 self.assertRaises(ValueError, lambda : (0, 1, 2)[huh])
+
     def test_true(self):
         "true"
         for true in 'True', 'yes', 't', 'Y', 7, ['blah']:
@@ -527,6 +549,7 @@ class TestLogical(unittest.TestCase):
             self.assertEqual(huh != None, True)
             if py_ver >= (2, 5):
                 self.assertEqual((0, 1, 2)[huh], 1)
+
     def test_false(self):
         "false"
         for false in 'false', 'No', 'F', 'n', 0, []:
@@ -539,6 +562,7 @@ class TestLogical(unittest.TestCase):
             self.assertEqual(huh == None, False)
             if py_ver >= (2, 5):
                 self.assertEqual((0, 1, 2)[huh], 0)
+
     def test_singletons(self):
         "singletons"
         heh = Logical(True)
@@ -550,9 +574,11 @@ class TestLogical(unittest.TestCase):
         self.assertEqual(heh is hah, True)
         self.assertEqual(ick is ack, True)
         self.assertEqual(unk is bla, True)
+
     def test_error(self):
         "errors"
         self.assertRaises(ValueError, Logical, 'wrong')
+
     def test_and(self):
         "and"
         true = Logical(True)
@@ -1027,6 +1053,7 @@ class TestLogical(unittest.TestCase):
         self.assertEqual(-true, -1)
         self.assertEqual(-false, 0)
         self.assertEqual(-none, none)
+
     def test_posation(self):
         "posation"
         true = Logical(True)
@@ -1035,6 +1062,7 @@ class TestLogical(unittest.TestCase):
         self.assertEqual(+true, 1)
         self.assertEqual(+false, 0)
         self.assertEqual(+none, none)
+
     def test_abs(self):
         "abs()"
         true = Logical(True)
@@ -1043,6 +1071,7 @@ class TestLogical(unittest.TestCase):
         self.assertEqual(abs(true), 1)
         self.assertEqual(abs(false), 0)
         self.assertEqual(abs(none), none)
+
     def test_invert(self):
         "~ operator"
         true = Logical(True)
@@ -1336,6 +1365,7 @@ class TestLogical(unittest.TestCase):
         u = None
         u *= unknown
         self.assertEqual(u, unknown)
+
     def test_subtraction(self):
         "subtraction"
         true = Logical(True)
@@ -1676,6 +1706,7 @@ class TestLogical(unittest.TestCase):
         u = None
         u //= unknown
         self.assertEqual(u, unknown)
+
     def test_shift(self):
         "<< and >>"
... 1691 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/dbf.git



More information about the Python-modules-commits mailing list