Stop using functools.total_ordering
It is only available since 2.7, and only saves us from defining three trivial methods. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
9ab9aaf8d9
commit
b55f8abd29
@ -6,7 +6,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import json
|
import json
|
||||||
import functools
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
@ -32,7 +31,6 @@ class MockPathInfo(object):
|
|||||||
return os.path.join('rpms', self.get_filename(rpm_info))
|
return os.path.join('rpms', self.get_filename(rpm_info))
|
||||||
|
|
||||||
|
|
||||||
@functools.total_ordering
|
|
||||||
class MockFile(object):
|
class MockFile(object):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
if path.startswith('/tmp'):
|
if path.startswith('/tmp'):
|
||||||
@ -63,6 +61,15 @@ class MockFile(object):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
return self.file_path < other
|
return self.file_path < other
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
return self <= other and self != other
|
||||||
|
|
||||||
|
def __ge__(self, other):
|
||||||
|
return not (self <= other) or self == other
|
||||||
|
|
||||||
|
def __gt__(self, other):
|
||||||
|
return not (self <= other)
|
||||||
|
|
||||||
|
|
||||||
class MockFileCache(dict):
|
class MockFileCache(dict):
|
||||||
"""Mock for kobo.pkgset.FileCache.
|
"""Mock for kobo.pkgset.FileCache.
|
||||||
|
Loading…
Reference in New Issue
Block a user