File: test_api.py

package info (click to toggle)
keras 2.3.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,288 kB
  • sloc: python: 48,266; javascript: 1,794; xml: 297; makefile: 36; sh: 30
file content (32 lines) | stat: -rw-r--r-- 739 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest
import pyux
import keras
import json
import os

import keras.backend.tensorflow_backend
import keras.backend.theano_backend
import keras.backend.cntk_backend
import keras.backend.numpy_backend
import keras.utils.test_utils


def test_api():
    api_file = os.path.join(os.getcwd(), 'api.json')
    with open(api_file, 'r') as f:
        previous_api = json.load(f)
    current_api = pyux.sign(keras)
    diff = pyux.diff(current_api, previous_api)

    exceptions = [
        pyux.ADDED_ARG_WITH_DEFAULT_IN_METHOD,
        pyux.ADDED_DEFAULT_IN_METHOD
    ]

    diff = list(filter(lambda c: c[0] not in exceptions, diff))
    if diff:
        raise pyux.APIChangedException(diff)


if __name__ == '__main__':
    test_api()