Skip to content

Commit 98ceb52

Browse files
committed
makes all imports relative and changes unittest running method
1 parent b2e3acf commit 98ceb52

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ dist/
66
python_rest_client.egg-info/*
77
rest_client.egg-info/*
88
python_rest_model.egg-info/
9+
.coverage

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ machine:
33
version: 3.4.3
44
test:
55
override:
6-
- python rest_model/tests.py
6+
- python -m unittest discover -t .

rest_model/meta_classes.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
Meta Classes:
44
RestModelMeta -- create rest-model classes.
55
"""
6-
try:
7-
from .primitives import Typed
8-
except SystemError:
9-
from primitives import Typed
6+
from .primitives import Typed
7+
108
import json
119
import requests
1210

rest_model/models.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
"""Contain Fields to be used by user code."""
2-
try:
3-
from .meta_classes import RestModelMeta
4-
from .primitives import Integer, Positive, String, Float, List
5-
except SystemError:
6-
from meta_classes import RestModelMeta
7-
from primitives import Integer, Positive, String, Float, List
2+
from .meta_classes import RestModelMeta
3+
from .primitives import Integer, Positive, String, Float, List
84

95

106
class RestModel(metaclass=RestModelMeta):

rest_model/tests.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
from unittest.mock import patch
33
import unittest
44
import json
5-
import models
5+
from .models import RestModel, StringField, PositiveFloatField, \
6+
PositiveIntegerField
67

78

8-
class Stock(models.RestModel):
9+
class Stock(RestModel):
910
"""Implement Rest model."""
1011

11-
name = models.StringField()
12-
shares = models.PositiveIntegerField()
13-
price = models.PositiveFloatField()
12+
name = StringField()
13+
shares = PositiveIntegerField()
14+
price = PositiveFloatField()
1415

1516
class Meta:
1617
"""Associate actions with endpoints."""
@@ -21,12 +22,12 @@ class Meta:
2122
get = "http://shangri-la/stocks/"
2223

2324

24-
class Student(models.RestModel):
25+
class Student(RestModel):
2526
"""Implement Rest model."""
2627

27-
name = models.StringField()
28-
age = models.PositiveIntegerField()
29-
gpa = models.PositiveFloatField()
28+
name = StringField()
29+
age = PositiveIntegerField()
30+
gpa = PositiveFloatField()
3031

3132
class Meta:
3233
"""Associate actions with endpoints."""

0 commit comments

Comments
 (0)