# Path: washmap/stats/models.py
# class StatValue(models.Model):
#     class Meta:
#         unique_together = ('description', 'country', 'year')
# 
#     description = models.ForeignKey(StatDescription)
#     country = models.ForeignKey(Country)
#     year = models.IntegerField()
#     value = models.DecimalField(max_digits=20, decimal_places=10, null=True, blank=True)  # nopep8
# 
#     def __unicode__(self):
#         return "%s, %s, %s" % (
#             self.country,
#             self.year,
#             self.value
#         )


import json
import pytest
from bs4 import BeautifulSoup
from django_dynamic_fixture import G
from django.contrib.auth.models import User
from django.utils import translation
from main.models import Country
from country_comparison.views import CountrySummary
from ..models import StatValue
    assert len(data_views) == 1
    table = data_views[0].table

    # With two rows
    rows = table.find_all("tr")
    assert len(rows) == 2

    # With first row having headers
    assert rows[0].find_all("th")[0].text == 'Year'
    assert rows[0].find_all("th")[1].text == 'Value'

    # And second row having stat_value
    assert "2010" in rows[1].find_all("td")[0].text
    assert "1" in rows[1].find_all("td")[1].find_all(class_="_stat_value")[0].text  # nopep8


@pytest.mark.django_db
@pytest.mark.urls('country_comparison.test_urls')
def test_table_with_multiple_rows(
    stat_a_i, zambia, summary_url, client
):

    G(StatValue, description=stat_a_i, country=zambia, year=2010, value=1)
    G(StatValue, description=stat_a_i, country=zambia, year=2011, value=2)
    G(StatValue, description=stat_a_i, country=zambia, year=2012, value=3)

    stat_a_i.hide_graph = True
    stat_a_i.save()

    # Get the Zambia Page

# Path: washmap/stats/models.py
# class StatValue(models.Model):
#     class Meta:
#         unique_together = ('description', 'country', 'year')
# 
#     description = models.ForeignKey(StatDescription)
#     country = models.ForeignKey(Country)
#     year = models.IntegerField()
#     value = models.DecimalField(max_digits=20, decimal_places=10, null=True, blank=True)  # nopep8
# 
#     def __unicode__(self):
#         return "%s, %s, %s" % (
#             self.country,
#             self.year,
#             self.value
#         )


# Path: washmap/stats/tests/country_summary_view_tests.py
import json
import pytest
from bs4 import BeautifulSoup
from django_dynamic_fixture import G
from django.contrib.auth.models import User
from django.utils import translation
from main.models import Country
from country_comparison.views import CountrySummary
from ..models import StatValue

    assert len(data_views) == 1
    table = data_views[0].table

    # With two rows
    rows = table.find_all("tr")
    assert len(rows) == 2

    # With first row having headers
    assert rows[0].find_all("th")[0].text == 'Year'
    assert rows[0].find_all("th")[1].text == 'Value'

    # And second row having stat_value
    assert "2010" in rows[1].find_all("td")[0].text
    assert "1" in rows[1].find_all("td")[1].find_all(class_="_stat_value")[0].text  # nopep8


@pytest.mark.django_db
@pytest.mark.urls('country_comparison.test_urls')
def test_table_with_multiple_rows(
    stat_a_i, zambia, summary_url, client
):

    G(StatValue, description=stat_a_i, country=zambia, year=2010, value=1)
    G(StatValue, description=stat_a_i, country=zambia, year=2011, value=2)
    G(StatValue, description=stat_a_i, country=zambia, year=2012, value=3)

    stat_a_i.hide_graph = True
    stat_a_i.save()

    # Get the Zambia Page

    response = client.get(summary_url)