Commit e02dea12 authored by Cyril Roelandt's avatar Cyril Roelandt
Browse files

upt.licenses.License: add __eq__.

parent d9cd519e
......@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
Based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- upt.licenses.License: add __eq__ so that comparisons do not fail
## [0.2.1] - 2018-03-04
### Added
- upt.licenses: Add the OpenSSL license
......
......@@ -21,6 +21,9 @@ class License(object):
def is_dfsg_compatible(self):
return False
def __eq__(self, other):
return self.spdx_identifier == other.spdx_identifier
class OSIApprovedLicense(License):
def is_osi_approved(self):
......
......@@ -71,3 +71,10 @@ class TestLicenses(unittest.TestCase):
match_fn.return_value = match
self.assertIsInstance(licenses.guess_from_file('/some/path'),
licenses.BSDThreeClauseLicense)
def test_equality(self):
self.assertEqual(licenses.BSDThreeClauseLicense(),
licenses.BSDThreeClauseLicense())
self.assertNotEqual(licenses.BSDTwoClauseLicense(),
licenses.BSDThreeClauseLicense())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment