Skip to content

Commit

Permalink
makes all imports relative and changes unittest running method
Browse files Browse the repository at this point in the history
  • Loading branch information
mdaif committed Nov 1, 2015
1 parent b2e3acf commit 98ceb52
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist/
python_rest_client.egg-info/*
rest_client.egg-info/*
python_rest_model.egg-info/
.coverage
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ machine:
version: 3.4.3
test:
override:
- python rest_model/tests.py
- python -m unittest discover -t .
6 changes: 2 additions & 4 deletions rest_model/meta_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
Meta Classes:
RestModelMeta -- create rest-model classes.
"""
try:
from .primitives import Typed
except SystemError:
from primitives import Typed
from .primitives import Typed

import json
import requests

Expand Down
8 changes: 2 additions & 6 deletions rest_model/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
"""Contain Fields to be used by user code."""
try:
from .meta_classes import RestModelMeta
from .primitives import Integer, Positive, String, Float, List
except SystemError:
from meta_classes import RestModelMeta
from primitives import Integer, Positive, String, Float, List
from .meta_classes import RestModelMeta
from .primitives import Integer, Positive, String, Float, List


class RestModel(metaclass=RestModelMeta):
Expand Down
19 changes: 10 additions & 9 deletions rest_model/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
from unittest.mock import patch
import unittest
import json
import models
from .models import RestModel, StringField, PositiveFloatField, \
PositiveIntegerField


class Stock(models.RestModel):
class Stock(RestModel):
"""Implement Rest model."""

name = models.StringField()
shares = models.PositiveIntegerField()
price = models.PositiveFloatField()
name = StringField()
shares = PositiveIntegerField()
price = PositiveFloatField()

class Meta:
"""Associate actions with endpoints."""
Expand All @@ -21,12 +22,12 @@ class Meta:
get = "http://shangri-la/stocks/"


class Student(models.RestModel):
class Student(RestModel):
"""Implement Rest model."""

name = models.StringField()
age = models.PositiveIntegerField()
gpa = models.PositiveFloatField()
name = StringField()
age = PositiveIntegerField()
gpa = PositiveFloatField()

class Meta:
"""Associate actions with endpoints."""
Expand Down

0 comments on commit 98ceb52

Please sign in to comment.