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

Models tests #5

Open
1 task
mansogf opened this issue Aug 4, 2021 · 1 comment
Open
1 task

Models tests #5

mansogf opened this issue Aug 4, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@mansogf
Copy link
Contributor

mansogf commented Aug 4, 2021

What is expected:

  • Create tests for models;
@mansogf mansogf added the enhancement New feature or request label Aug 4, 2021
@m-theus
Copy link

m-theus commented Aug 25, 2021

Hi @mansogf, I'd like to implement the model tests.

I'll use this approach:

def test_error_model_cpu():
    with pytest.raises(Exception) as TypeError:
        cpu = Cpu(non_existent_field="Test")

def test_model_cpu():
    cpu = Cpu(
        id=1, name="Cpu name test", number_of_cores=2, frequency=3.456,
        fp32_per_cycle=7, transistors=8, tdp=9.101, gflops=1.121, die_size=3, year=2014
    )

    assert "app.models.cpu" == cpu.__module__    
    assert "cpu" == cpu.__tablename__

    assert 1 == cpu.id
    assert "Cpu name test" == cpu.name
    assert 2 == cpu.number_of_cores
    assert 3.456 == cpu.frequency
    assert 7 == cpu.fp32_per_cycle
    assert 8 == cpu.transistors
    assert 9.101 == cpu.tdp
    assert 1.121 == cpu.gflops
    assert 3 == cpu.die_size
    assert 2014 == cpu.year

Can I start?

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

No branches or pull requests

2 participants