Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Use constant instead of string literal for 'npm'
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Feb 8, 2017
1 parent a72e900 commit 9c05276
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions gratipay/models/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
from postgres.orm import Model


NPM = 'npm' # We are starting with a single package manager. If we see
# traction we will expand.


class Package(Model):
"""Represent a gratipackage. :-)
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/py/test_packages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

from gratipay.models.package import Package
from gratipay.models.package import NPM, Package
from gratipay.testing import Harness


Expand All @@ -13,4 +13,4 @@ def test_can_be_instantiated_from_id(self):

def test_can_be_instantiated_from_names(self):
self.make_package()
assert Package.from_names('npm', 'foo').name == 'foo'
assert Package.from_names(NPM, 'foo').name == 'foo'

0 comments on commit 9c05276

Please sign in to comment.