You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def __str__(self):
return "<Dog:{self.name}--{self.age}>".format(self=self)
def __repr__(self):
return self.__str__()
def __init__(self, name, age):
self.name = name
self.age = age
def eat(self, food):
return "{self.name} is eating {food}".format(self=self, food=food)
> testcode:
```python
# coding:utf-8
from __future__ import print_function,absolute_import
from pyvows import Vows,expect
import sys
import os
from forgery_py import name as random_name
from random import randint
root = os.path.dirname(os.path.dirname(__file__))
sys.path[0] = root
import dog
@Vows.batch
class DogTest(Vows.Context):
def topic(self):
name = random_name.full_name()
age = randint(18,30)
return dog.Dog(name,age)
def can_eat(self, topic):
food = "apple"
expect(topic.eat(food)).to_equal("{topic.name} is eating {food}".format(topic=topic, food=food))
def can_be_print(self, topic):
expect(str(topic)).to_equal("<Dog:{topic.name}--{topic.age}>".format(topic=topic))
command:
pyvows test/ --pattern='*_test.py' -cover
result:
============
Vows Results
============
✓ OK » 2 honored • 0 broken (0.004289s)
/Users/huangsizhe/Lib/conda/anaconda/lib/python2.7/genericpath.py:80: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
s1 = min(m)
Could not run coverage. Error: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)
The text was updated successfully, but these errors were encountered:
class Dog(object):
pyvows test/ --pattern='*_test.py' -cover
✓ OK » 2 honored • 0 broken (0.004289s)
/Users/huangsizhe/Lib/conda/anaconda/lib/python2.7/genericpath.py:80: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
s1 = min(m)
Could not run coverage. Error: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)
The text was updated successfully, but these errors were encountered: