Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-c do not work for utf-8! #129

Open
hsz1273327 opened this issue Apr 17, 2016 · 0 comments
Open

-c do not work for utf-8! #129

hsz1273327 opened this issue Apr 17, 2016 · 0 comments

Comments

@hsz1273327
Copy link

my code:

# coding:utf-8
from __future__ import print_function

class Dog(object):

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant